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_pcvar, g_limit_pcvar
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
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 == 1 || 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 == 2 || 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 == 0 || 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 != 0 && i_userMoney > i_minMoney)
{
client_print(id, print_chat, "[AMXX] Sorry, you must have AT LEAST $%d to be given money.", i_minMoney)
return 0
}
cs_set_user_money(id, 16000)
client_print(id, print_chat, "[AMXX] You have been given $16000")
return 1
}
public adverTask()
{
client_print(0, print_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!