I tried to edit my "Heal for Money" plugin, but the plugin doesn't works. whats wrong?
Code:
/* Plugin generated by Emilioneri */
#include <amxmodx>
#include <cstrike>
#include <fun>
#define PLUGIN "Heal for money"
#define VERSION "1.1"
#define AUTHOR "Emilioneri"
new g_Cost
new yes[200]
new no[200]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
g_Cost = register_cvar("amx_healcost", "7000")
register_clcmd("say /buyheal", "cmd_buyheal")
}
public cmd_buyheal(id)
{
new menu = menu_create("\rDo you want to restore your health ??", "heal_menu")
formatex(yes, 199, "Yes")
menu_additem(menu, yes, "1")
formatex(no, 199, "No")
menu_additem(menu, no, "2")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}
public heal_menu(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new Data[6];
new Access;
new Name[64];
new Callback;
new Key = str_to_num(Data);
menu_item_getinfo(menu, item, Access, Data, 5, Name, 63, Callback)
switch (Key)
{
case 1:
{
if ( !is_user_alive (id) )
{
client_print(id, print_chat, "You can't buy health cuz you are dead!")
return PLUGIN_HANDLED
}
new iMoney = cs_get_user_money(id)
new iCost = get_pcvar_num(g_Cost)
if(iMoney >= iCost)
{
set_user_health(id, 100)
cs_set_user_money(id, iMoney - iCost)
client_print(id, print_chat, "Your health have been restored for $%i", iCost)
return PLUGIN_HANDLED
}
else
{
client_print(id, print_chat, "You don't have enaugh money! $%i needed!", iCost)
}
return PLUGIN_HANDLED
}
case 2:
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
}
return PLUGIN_HANDLED
}