Hey world.
I have maked for me a weaponmenu only for the ctīs.
I have the problem, that when they close their menu, they canīt reopen it. It would be great, if someone can make a check, if they have already a weapon from the weapon menu or not. If yes, the canīt reopen the menu. If not, they can reopen the menu.
Another nice idea is, that the weapon menu overwrite all other menus
Here my weapon menu:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#define PLUGINNAME "WeaponsforCT"
#define VERSION "0.1b"
#define AUTHOR "STrike"
public plugin_init()
{
register_plugin(PLUGINNAME, VERSION, AUTHOR)
register_event( "ResetHUD", "Event_ResetHUD", "be" );
register_clcmd( "AntiFurien WaffenMenu","WeaponMenuforCt");
}
public Event_ResetHUD(id)
{
if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
{
WeaponMenuforCt(id)
}
}
public WeaponMenuforCt(id)
{
new menu = menu_create("\rAntiFurien WaffenMenu:", "menu_handler");
menu_additem(menu, "\wak47 + Deagle", "1", 0);
menu_additem(menu, "\wM4A1 + Deagle", "2", 0);
menu_additem(menu, "\wMP5 Navy + Deagle", "3", 0);
menu_additem(menu, "\wXM1014 + Deagle", "4", 0);
menu_additem(menu, "\wM3 + Deagle", "5", 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:
{
give_item(id, "weapon_ak47")
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id,CSW_AK47,90)
cs_set_user_bpammo(id,CSW_DEAGLE,35)
}
case 2:
{
give_item(id, "weapon_m4a1")
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id,CSW_M4A1,90)
cs_set_user_bpammo(id,CSW_DEAGLE,35)
}
case 3:
{
give_item(id, "weapon_mp5navy")
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id,CSW_MP5NAVY,120)
cs_set_user_bpammo(id,CSW_DEAGLE,35)
}
case 4:
{
give_item(id, "weapon_xm1014")
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id,CSW_XM1014,32)
cs_set_user_bpammo(id,CSW_DEAGLE,35)
}
case 5:
{
give_item(id, "weapon_m3")
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id,CSW_M3,32)
cs_set_user_bpammo(id,CSW_DEAGLE,35)
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}