Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "2Money"
#define AUTHOR "Test Vince"
#define VERSION "1.0"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_money", "cmd_money", ADMIN_SLAY, "<moneyt> <moneyct>")
}
public cmd_money(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new Arg1[8]
new Arg2[8]
//Get the command arguments from the console
read_argv(1, Arg1, 7)
read_argv(2, Arg2, 7)
//Convert the money from a string to a number
new moneyyt = str_to_num(Arg1)
new moneyyct = str_to_num(Arg2)
new players[32], num
get_players(players, num)
for (new i=0; i<num; i++)
{
if (get_user_team(players[i]) == 1)
cs_set_user_money(players[i], moneyyt)
else
cs_set_user_money(players[i], moneyyct)
}
return PLUGIN_HANDLED
}
public client_PreThink(id)
{
new iTarget,iBody
get_user_aiming(id,iTarget,iBody,200)
if(!iTarget)
return PLUGIN_CONTINUE
new iMoney = cs_get_user_money(iTarget),szName[33],szMessage[128]
get_user_name(iTarget,szName,32)
format(szMessage,127,"%s: $%i",szName,iMoney)
set_hudmessage(200,100,0,0.5,0.5,0,0.1,0.1,0.1,0.1,4)
show_hudmessage(id,"%s",szMessage)
return PLUGIN_CONTINUE
}