Help me in this.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#define PLUGIN "Stat Menu(Test Mod)"
#define VERSION "1.1"
#define AUTHOR "ianglowz"
new plugin_on
new speedprice,armorprice,healthprice
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /stat" , "statmenu")
plugin_on = register_cvar("sm_pluginon","1")
speedprice = register_cvar("sm_speedprice","2000")
armorprice = register_cvar("sm_armorprice","2000")
healthprice = register_cvar("sm_healthprice","2500")
}
public statmenu(id)
{
new money = cs_get_user_money(id)
if (get_pcvar_num(plugin_on) == 1)
new menu = menu_create( "Choose your stat", "menu_handler")
menu_additem(menu, "Speed", "1", 0)
menu_additem(menu, "Armor", "2", 0)
menu_additem(menu, "Health", "3",0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}
public menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:{
if (money >= get_pcvar_num(speedprice))
client_print(id, print_chat, "You have selected Speed Stats.")
set_user_maxspeed(id , 5)
menu_destroy(menu)
return PLUGIN_HANDLED
}
else
{
client_print(id ,print_chat, "You do not have enough money.WORK HARD!!")
}
case 2:{
if (money >= get_pcvar_num(armorprice))
client_print(id, print_chat, "You have selected Armor Stats")
set_user_armor(id,200)
menu_destroy(menu)
return PLUGIN_HANDLED
}
else
{
client_print(id ,print_chat, "You do not have enough money.WORK HARD!!")
}
case 3:{
if (money >= get_pcvar_num(healthprice))
client_print(id, print_chat, "You have choose Health Stats")
set_user_health(id,200)
menu_destroy(menu)
return PLUGIN_HANDLED
}
else
{
client_print(id ,print_chat, "You do not have enough money.WORK HARD!!")
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
But get error on compile.
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
Error: Declaration of a local variable must appear in a compound block on line 32
Error: Undefined symbol "menu" on line 32
Error: Undefined symbol "menu" on line 34
Warning: Expression has no effect on line 34
Warning: Expression has no effect on line 34
Warning: Expression has no effect on line 34
Error: Expected token: ";", but found ")" on line 34
Error: Invalid expression, assumed zero on line 34
Error: Too many error messages on one line on line 34
Compilation aborted.
6 Errors.
Could not locate output file C:\Program Files\AMX Mod X\amxxstudio\Untitled.amx (compile failed).
__________________