#include <amxmodx>
#include <fun>
#include <cstrike>
public plugin_init()
{
register_clcmd( "weapon","WeaponMenu");
}
public WeaponMenu(id)
{
new menu = menu_create("\r武器選單", "menu_player")
menu_additem(menu, "\w AWP", "1", 0)
menu_additem(menu, "\w M4A1", "2", 0)
menu_additem(menu, "\w AK47", "3", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}
public menu_player(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:
{
give_item(id, "weapon_awp")
cs_set_user_bpammo(id , CSW_AWP , 40)
cs_set_user_bpammo(id , CSW_DEAGLE , 42)
give_item(id, "weapon_deagle")
give_item(id, "weapon_smokegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_hegrenade")
set_user_armor(id, 100)
menu_destroy(menu)
return PLUGIN_HANDLED
}
case 2:
{
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id , CSW_M4A1 , 120)
cs_set_user_bpammo(id , CSW_DEAGLE , 42)
give_item(id, "weapon_deagle")
give_item(id, "weapon_smokegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_hegrenade")
set_user_armor(id, 100)
menu_destroy(menu)
return PLUGIN_HANDLED
}
case 3:
{
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id , CSW_AK47 , 120)
cs_set_user_bpammo(id , CSW_DEAGLE , 42)
give_item(id, "weapon_deagle")
give_item(id, "weapon_smokegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_hegrenade")
set_user_armor(id, 100)
menu_destroy(menu)
return PLUGIN_HANDLED
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
1. give_item