| Depresie |
08-28-2015 17:31 |
[HELP] Menu Problem
so i have managed to create this menu plugin by following the tutorials posted on this forum, the problem is i get run time errors, any ideeas?
sorry, this is the first menu i ever made...
logs:
code:
PHP Code:
#include < amxmodx > #include < cstrike > #include < fun > #include < zp50_core > #include < zp50_class_survivor > #include < zp50_class_sniper > #include <rz_vip_core > #include < zp50_colorchat >
const PRIMARY = ((1<<CSW_M4A1)|(1<<CSW_AK47)|(1<<CSW_GALI)|(1<<CSW_FAMAS)|(1<<CSW_AUG)|(1<<CSW_SG550)|(1<<CSW_SG552)|(1<<CSW_G3SG1)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_TMP)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_P90)|(1<<CSW_SCOUT)|(1<<CSW_M3)|(1<<CSW_XM1014)|(1<<CSW_P90)|(1<<CSW_M249))
new g_used[33]
public plugin_init() { register_plugin( "[VIP] Weapon Menu", "1.0", "ADN" ); register_clcmd("say /weapon", "weapon_menu") register_event("HLTV", "HLTV", "a", "1=0", "2=0")
}
public HLTV() { for (new id; id <= 32; id++) { g_used[id] = false } } public weapon_menu(id) { if(!rz_is_user_happy(id) && !rz_is_user_vip(id) && !rz_is_user_god(id)) { zp_colored_print(id, "Only^x04 VIP^x01 players can use this command") return PLUGIN_HANDLED } if(!is_user_alive(id) || zp_core_is_zombie(id) || zp_class_survivor_get(id) || zp_class_sniper_get(id)) { zp_colored_print(id, "This command cannot be used right now") return PLUGIN_HANDLED } if(g_used[id]) { zp_colored_print(id, "This command can be used once per round") return PLUGIN_HANDLED } new menu = menu_create( "Weapon Menu", "principal_handler" ); menu_additem(menu, "SG550 Auto Sniper", "1", 0); menu_additem(menu, "G3SG1 Auto Sniper", "2", 0); menu_additem(menu, "M-249 Machine Gun", "3", 0); menu_setprop( menu, MPROP_EXITNAME, "Exit") menu_display( id, menu, 0); return PLUGIN_CONTINUE; }
public principal_handler(id, menu, item) { if(!is_user_alive(id) || zp_core_is_zombie(id) || zp_class_survivor_get(id) || zp_class_sniper_get(id)) { menu_destroy(menu) return PLUGIN_HANDLED } switch(item) { case 0: { drop_prim(id) give_item(id, "weapon_sg550") cs_set_user_bpammo(id, CSW_SG550, 90) g_used[id] = true } case 1: { drop_prim(id) give_item(id, "weapon_g3sg1") cs_set_user_bpammo(id, CSW_G3SG1, 90) g_used[id] = true } case 2: { drop_prim(id) give_item(id, "weapon_m249") cs_set_user_bpammo(id, CSW_M249, 200) g_used[id] = true } case MENU_EXIT: { menu_destroy(menu) } } menu_destroy(menu); return PLUGIN_HANDLED; }
stock drop_prim(id) { new weapons[32], num get_user_weapons(id, weapons, num) for (new i = 0; i < num; i++) { if (PRIMARY & (1<<weapons[i])) { static wname[32] get_weaponname(weapons[i], wname, sizeof wname - 1) engclient_cmd(id, "drop", wname) } } }
|