This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

sixteenK


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-16-2012 , 17:46   sixteenK
Reply With Quote #1

I was looking around for a while once for a mod that either allowed for a "/moneyme" or giving money at spawn. Since i couldn't find one i just went and wrote my own. This particular plugin does both, with both functions toggleable.

FEATURES:
Give Money Limit (amxx_16k_limit)
-->sets the range in which users will be able to get money. i.e. if a user's money is less than defined
/moneyme
-->gives $16000 instantly to any user, as long as their money is under the limit set in amxx_16k_limit
startMoney
-->gives $16000 instantly on spawn, as long as their money is under the limit set in amxx_16k_limit
/moneyme advertisements
-->by default disabled. to enable: edit source and uncomment the line "//#define ADS" then recompile and upload.
admin amx_givemoney command
-->amx_givemoney [target] [amount] :Gives money to a specified player or group (@all, @ct, @t supported)
AMXX Admin conformity
-->admin command's confirmation goes by AMXX's show_admin_activity standards
Customizable Money Amount
-->Edit the MONEY define to whatever number you'd like to edit how much money this plugin gives


Please Note: CVARs have changed names! -since v2.1
CVARs:
amx_16k 2 // <0|1|2|3> 0=off; 1=/moneyme on; 2=spawn money on; 3=all on
amx_16k_limit 3500 // <0-16000> sets the maximum amount of money a user can have to get money (0 = no limit)

INSTALLATION:
upload the amxx into .../addons/amxmodx/plugins
add "liver_sixteenK.amxx" to plugins.ini in ".../addons/amxmodx/configs"

MODULES:
make sure the following lines are uncommented (no semicolon before them) in your .../addons/amxmodx/configs/modules.ini file
cstrike
hamsandwich

note: some servers don't automatically have hamsandwich in the modules.ini; simply type it in on a new line at the bottom and save it.

The following code is no longer up to date. I only added remedial things, sma is complete
PHP Code:
/* Script generated by Pawn Studio 

*     Writen By: Brandon "Liverwiz"
*         Last Edit: 4/22/12
*     No warrenties of any kind, especially for idiots that break stuff
*     Support available on the indicated AM thread

*     Located on AlliedModders forums
*         URL: http://forums.alliedmods.net/showthread.php?t=183073


*     //////////////////////
*     //        CVARS        //
*     //////////////////////
*         amxx_16k <0|1|2|3>    0=off; 1=/moneyme on; 2=spawn money on; 3=all on
*         amxx_16k_limit <0-16000>    sets money a user needs before they can get money


*     //////////////////////////////
*     //        CHANGE LOG            //
*     //////////////////////////////
*         VERSION 1.0
*     - initial release

*         VERSION 1.1
*     - uses Ham_spawn instead of register_event    - changed funciton header accordingly
*     - change variable names to conform to HN
*     - exclude bots from getting money....greedy bastards

*         VERSION 2.0
*     - improved CVAR
*     - added command help for /moneyme
*     - added advertisements - toggled as defined by ADS 0
*     - made it so you can limit when people can get money (if less than so much)
*         > added appropriate CVAR
*     - NOW: /moneyme a seperate flag, and can be turned off (to prevent buy spamming)
*     - able to enable both spawn and /moneyme 

*         VERSION 2.1
*     - bug fix


*             TODO LIST
*     -2.0- more intuitive cvar
*     -2.0- advertisement if spawn is not enabled -scraped &toggled(who cares about ads)

*    //////////////////
*     //    THANKS!        //
*     //////////////////
*     - epicMonkey: told me to use ham_spawn
*     - Xalus: example of HOW to use ham_spawn, along with other ideas
*/


#include <amxmodx>
#include <cstrike>
#include <hamsandwich>        // WITH CHEESE!

#define PLUGIN    "Sixteen K"
#define AUTHOR    "LIverwiz"
#define VERSION    "2.1"

//#define ADS                // uncomment this this line if you'd like advertisements desplayed for /moneyme (when moneyme is enabled)

new g_16k_pcvarg_limit_pcvar

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_16k_pcvar register_cvar("amxx_16k""2")
    
g_limit_pcvar register_cvar("amxx_16k_limit""3500")
    
    
RegisterHam(Ham_Spawn"player""ham_startMoney"1)
    
register_clcmd("say /moneyme""cmdMoney", -1"This command gives the user $16000 instantly.")
#if defined ADS
    
new i_cvarFlag get_pcvar_num(g_16k_pcvar)
    if(
i_cvarFlag == || i_cvarFlag == 3)            // if /moneyme is active
        
set_task(45.0"adverTask"0, .flags="b")    // we ADVERTISE! xD
#endif
}

public 
ham_startMoney(id)
{            
// checks to see if startMoney is enabled & user isn't a bot
    
new i_cvarFlag get_pcvar_num(g_16k_pcvar)
    if( (
i_cvarFlag == || i_cvarFlag == 3) && !is_user_bot(id))
        
give_money(id)
}

public 
cmdMoney(id)
{            
// checks to see if /moneyme is enabled
    
new i_cvarFlag get_pcvar_num(g_16k_pcvar)
    if(
i_cvarFlag == || i_cvarFlag == 2)
        return 
PLUGIN_CONTINUE
    give_money
(id)
    
    return 
PLUGIN_HANDLED
}
            
// returns 1 if money was given, 0 if not
public give_money(id)
{
    new 
i_minMoney get_pcvar_num(g_limit_pcvar)
    new 
i_userMoney cs_get_user_money(id)
            
// checks to see if there is a limit on money, and if the user is within that limit
    
if(i_minMoney != && i_userMoney i_minMoney)
    {
        
client_print(idprint_chat"[AMXX] Sorry, you must have AT LEAST $%d to be given money."i_minMoney)
        return 
0
    
}
    
    
cs_set_user_money(id16000)
    
client_print(idprint_chat"[AMXX] You have been given $16000"
    
    return 
1
}

public 
adverTask()
{
    
client_print(0print_chat"[AMXX] If you're running low on cash type /moneyme to get instant $16000!")


Mostly looking for some feedback. I'd love to know how it runs, and to see people using it. Enjoy!
Attached Files
File Type: sma Get Plugin or Get Source (liver_sixteenK.sma - 694 views - 7.8 KB)

Last edited by Liverwiz; 06-07-2012 at 21:48. Reason: version 2.3 update 6/07
Liverwiz is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-17-2012 , 08:33   Re: sixteenK
Reply With Quote #2

i made a similar plugin , but instead used ham_spawn ... , your code looks over done
EpicMonkey is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 04-17-2012 , 10:05   Re: sixteenK
Reply With Quote #3

useless
__________________
kiki33hun is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-18-2012 , 10:25   Re: sixteenK
Reply With Quote #4

Quote:
Originally Posted by EpicMonkey View Post
i made a similar plugin , but instead used ham_spawn ... , your code looks over done
What's the functional difference between what i did and ham_spawn? i hvaen't gotten into ham yet, and am still learning pawn and the amxx API.
Liverwiz is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 04-18-2012 , 11:02   Re: sixteenK
Reply With Quote #5

Quote:
Originally Posted by Liverwiz View Post
What's the functional difference between what i did and ham_spawn? i hvaen't gotten into ham yet, and am still learning pawn and the amxx API.
The thing is that U don't need a for loop.
-> Less CPU


[Edit]
- You may could it with an amount (For example: $5000). And on spawn, if player got less, put hes cash that amount. Else don't change anything.

- With that U dont need to have a cvar for on / off. So if money == 0, means its off ;)
__________________
Retired.

Last edited by Xalus; 04-18-2012 at 11:05.
Xalus is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-18-2012 , 16:10   Re: sixteenK
Reply With Quote #6

Quote:
Originally Posted by Xalus View Post
- You may could it with an amount (For example: $5000). And on spawn, if player got less, put hes cash that amount. Else don't change anything.

- With that U dont need to have a cvar for on / off. So if money == 0, means its off ;)
Sounds like you have a good idea....i just can't quite decipher it. Anyone have a translate for me?

if i can figure out hamsandwich i'll deff switch to ham_spawn thanks for the suggestion!
Liverwiz is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 04-18-2012 , 16:41   Re: sixteenK
Reply With Quote #7

Here you got an example,
test it, and you can use it if U want.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "Startin' money"
#define VERSION "1.0"
#define AUTHOR "Xalus"

new cMoney

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Register: Cvar
    
cMoney register_cvar("starting_money""5000")
    
    
// Register: Ham
    
RegisterHam(Ham_Spawn"player""Ham_PlayerSpawn"1);
}
public 
Ham_PlayerSpawn(id) {
    if(
is_user_alive(id)) {
        new 
iMoney get_pcvar_num(cMoney)

        if( 
iMoney && cs_get_user_money(id) < iMoney)
            
cs_set_user_money(idiMoney)
    }

__________________
Retired.

Last edited by Xalus; 04-18-2012 at 16:42. Reason: Optimizing
Xalus is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-18-2012 , 17:35   Re: sixteenK
Reply With Quote #8

Random question.....how bad is this code? putting an if statement in the plugin_init to register commands as per cvars?

Quote:
new toggle_pcvar, spawn_pcvar

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
toggle_pcvar = register_cvar("amxx_16k", "1")
spawn_pcvar = register_cvar("amxx_16k_start", "0")

register_clcmd("say /moneyme", "give_money")

new flag = get_pcvar_num(spawn_pcvar)
if(flag == 1)
register_event("start", "start_money", "a", "1=Round_Start")

}
I'd do this merely to lower overhead of the overall plugin, not having to listen for that event sounds like it might be a good idea, but i'm a noob. Thoughts?
Liverwiz is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-18-2012 , 17:41   Re: sixteenK
Reply With Quote #9

And thanks for that code, Xalus! I'm definately going to use that ham code, and put it into this plugin.

It does look like you have a good idea, making sure everyone has a minimum constant money and i'll keep that in mind for possible later mods. Though it doesn't really fulfill the concept of this plugin (to be dual purpose for an administrator, /moneyme and/or round cash)
Liverwiz is offline
FODDER
Member
Join Date: Mar 2012
Location: Florida, United States
Old 04-18-2012 , 18:39   Re: sixteenK
Reply With Quote #10

You searched real hard.
https://forums.alliedmods.net/showthread.php?t=2131
/close
FODDER is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode