public handgun(id)
{
new menu = menu_create("\r手枪选单","menu_handler");
menu_additem(menu, "\wGlock18(等级:0)", "1",0);
menu_additem(menu, "\wUSP(等级:5)","2",0)
menu_additem(menu, "\wP228(等级:10)","3",0)
menu_additem(menu, "\wFive-Seven(等级:15)","4",0)
menu_additem(menu, "\wDeagle(等级:20)","5",0)
menu_additem(menu, "\wElite(等级:25)","6",0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_setprop(menu, MPROP_EXITNAME,"离开")
menu_setprop(menu, MPROP_BACKNAME,"上页")
menu_setprop(menu, MPROP_NEXTNAME,"下页")
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:
{
if(cs_get_user_team(id) == 2 && is_user_alive(id) && buy[id] == 0)
{
buy[id] ++
give_item(id,"weapon_glock18")
client_cmd(id,"menu2")
client_printcolor(id,"/g【枪械系统】你已经获得/ctrGlock18/g手枪")
}
else if(!is_user_alive(id))
{
client_printcolor(id,"/g【枪械系统】你已经死亡,不能使用手枪选单")
}
else if(buy[id] == 1)
{
client_printcolor(id,"/g【枪械系统】你已经使用过手枪选单")
}
else if(cs_get_user_team(id) == 1 )
{
client_printcolor(id,"/g【枪械系统】你不是警察,不能使用手枪选单")
}
}
case 2:
{
if(cs_get_user_team(id) == 2 && is_user_alive(id) && buy[id] == 0 && get_user_level(id) >= 5 )
{
buy[id] ++
give_item(id,"weapon_usp")
client_cmd(id,"menu2")
client_printcolor(id,"/g【枪械系统】你已经获得/ctrUSP/g手枪")
}
else if(!is_user_alive(id))
{
client_printcolor(id,"/g【枪械系统】你已经死亡,不能使用手枪选单")
}
else if(buy[id] == 1)
{
client_printcolor(id,"/g【枪械系统】你已经使用过手枪选单")
}
else if(cs_get_user_team(id) == 1 )
{
client_printcolor(id,"/g【枪械系统】你不是警察,不能使用手枪选单")
}
else if(get_user_level(id) < 5 )
{
client_printcolor(id,"/g【枪械系统】你不够等级,不能使用此枪械")
client_cmd(id,"menu")
}
}
case 3:
{
if(cs_get_user_team(id) == 2 && is_user_alive(id) && buy[id] == 0 && get_user_level(id) >= 10 )
{
buy[id] ++
give_item(id,"weapon_p228")
client_cmd(id,"menu2")
client_printcolor(id,"/g【枪械系统】你已经获得/ctrP228/g手枪")
}
else if(!is_user_alive(id))
{
client_printcolor(id,"/g【枪械系统】你已经死亡,不能使用手枪选单")
}
else if(buy[id] == 1)
{
client_printcolor(id,"/g【枪械系统】你已经使用过手枪选单")
}
else if(cs_get_user_team(id) == 1 )
{
client_printcolor(id,"/g【枪械系统】你不是警察,不能使用手枪选单")
}
else if(get_user_level(id) < 10 )
{
client_printcolor(id,"/g?【枪械系统】你不够等级,不能使用此枪械")
client_cmd(id,"menu")
}
}
case 4:
{
if(cs_get_user_team(id) == 2 && is_user_alive(id) && buy[id] == 0 && get_user_level(id) >= 15)
{
buy[id] ++
give_item(id,"weapon_five-seven")
client_cmd(id,"menu2")
client_printcolor(id,"/g【枪械系统】你已经获得/ctrFive-Seven/g手枪")
}
else if(!is_user_alive(id))
{
client_printcolor(id,"/g【枪械系统】你已经死亡,不能使用手枪选单")
}
else if(buy[id] == 1)
{
client_printcolor(id,"/g【枪械系统】你已经使用过手枪选单")
}
else if(cs_get_user_team(id) == 1 )
{
client_printcolor(id,"/g【枪械系统】你不是警察,不能使用手枪选单")
}
else if(get_user_level(id) < 15 )
{
client_printcolor(id,"/g【枪械系统】你不够等级,不能使用此枪械")
client_cmd(id,"menu")
}
}
case 5:
{
if(cs_get_user_team(id) == 2 && is_user_alive(id) && buy[id] == 0 && get_user_level(id) >= 20)
{
buy[id] ++
give_item(id,"weapon_deagle")
client_cmd(id,"menu2")
client_printcolor(id,"/g【枪械系统】你已经获得/ctrDeagle/g手枪")
}
else if(!is_user_alive(id))
{
client_printcolor(id,"/g【枪械系统】你已经死亡,不能使用手枪选单")
}
else if(buy[id] == 1)
{
client_printcolor(id,"/g【枪械系统】你已经使用过手枪选单")
}
else if(cs_get_user_team(id) == 1 )
{
client_printcolor(id,"/g【枪械系统】你不是警察,不能使用手枪选单")
}
else if(get_user_level(id) < 20 )
{
client_printcolor(id,"/g【枪械系统】你不够等级,不能使用此枪械")
client_cmd(id,"menu")
}
}
case 6:
{
if(cs_get_user_team(id) == 2 && is_user_alive(id) && buy[id] == 0 && get_user_level(id) >= 25)
{
buy[id] ++
give_item(id,"weapon_elite")
client_cmd(id,"menu2")
client_printcolor(id,"/g【枪械系统】你已经获得/ctrElite/g手枪")
}
else if(!is_user_alive(id))
{
client_printcolor(id,"/g【枪械系统】你已经死亡,不能使用手枪选单")
}
else if(buy[id] == 1)
{
client_printcolor(id,"/g【枪械系统】你已经使用过手枪选单")
}
else if(cs_get_user_team(id) == 1 )
{
client_printcolor(id,"/g【枪械系统】你不是警察,不能使用手枪选单")
}
else if(get_user_level(id) < 25 )
{
client_printcolor(id,"/g【枪械系统】你不够等级,不能使用此枪械")
client_cmd(id,"menu")
}
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public client_connect()
{
client_cmd(0,"bind v servermenu")
}
public roundstart()
{
buy[id] = 0 <-----他说有问题
}