Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#define PLUGIN "Buy Health"
#define VERSION "1.0"
#define AUTHOR "Khalid"
new g_pCost, g_pHealth
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /buyhp", "cmd_buyhp")
g_pCost = register_cvar("hp_cost", "16000")
g_pHealth = register_cvar("hp_amount", "100")
}
public cmd_buyhp(id)
{
new iCost = get_pcvar_num(g_pCost)
new iUserMoney = cs_get_user_money(id)
if( cs_get_user_money(id) < iCost)
{
client_print(id, print_chat, "[AMXX] You need %d to buy health, current money: %d", iCost, iUserMoney )
return PLUGIN_HANDLED
}
client_print(id, print_chat, "[AMXX] You have bought 100 hp")
cs_set_user_money(id, iUserMoney - iCost, 1)
set_user_health( id, get_user_health(id) + get_pcvar_num(g_pHealth) )
return PLUGIN_HANDLED
}
__________________