| nikhilgupta345 |
06-17-2011 23:37 |
Re: Menu plugins problem (plz help me)
You had an extra brace on line 77 (it says the line number where the error occurs right next to the file name.)
You also had used fm_set_user_health, but had included the fun module, so I just changed it to set_user_health for you.
PHP Code:
#include <amxmodx> #include <cstrike> #include <fun> public plugin_init() { register_clcmd( "mshop","ExtraMenu"); }
public ExtraMenu(id) {
new menu = menu_create("\w something", "menu_handler"); menu_additem(menu, "\w something", "1", 0); menu_additem(menu, "\w something", "2", 0); menu_additem(menu, "\w something", "3", 0); menu_additem(menu, "\w something", "4", 0); menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); menu_display(id, menu, 0); return PLUGIN_HANDLED; } 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: { new money = cs_get_user_money(id) new money1 = 500; if (money <money1) { client_print(id, print_chat, "[AMXX] something $%d ", money1); return PLUGIN_CONTINUE; } else if (money >= money1) { give_item(id, "weapon_hegrenade"); cs_set_user_money(id, money-money1) menu_destroy(menu); return PLUGIN_HANDLED; } } case 2: { new money = cs_get_user_money(id) new money2 = 500; if (money <money2) { client_print(id, print_chat, "[AMXX] something $%d ", money2); return PLUGIN_CONTINUE; } else if (money >= money2) { give_item(id, "weapon_smokegrenade"); cs_set_user_money(id, money-money2) menu_destroy(menu); return PLUGIN_HANDLED; } } case 3: { new money = cs_get_user_money(id) new money3 = 5000; if (money <money3) { client_print(id, print_chat, "[AMXX] something $%d ", money3); return PLUGIN_CONTINUE; } else if (money >= money3) { client_print(id, print_chat, "[AMXX] something"); new health health = get_user_health(id) + 150 set_user_health(id, health) cs_set_user_money(id, money-money3) menu_destroy(menu); return PLUGIN_HANDLED; } } case 4: { new money = cs_get_user_money(id) new money4 = 1500; if (money <money4) { client_print(id, print_chat, "something $%d ", money4); return PLUGIN_CONTINUE; } else if (money >= money4) { client_print(id, print_chat, "[AMXX] something"); cs_set_user_armor(id ,150 ,CS_ARMOR_KEVLAR); cs_set_user_money(id, money-money4) menu_destroy(menu); return PLUGIN_HANDLED; } } } menu_destroy(menu);
return PLUGIN_HANDLED; } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par } */
|