下面是引用 eric512 于 2013-07-08 15:05 发表的 :
睇吾明= =
可以将成篇文写番完整我吗?
算了...我看还是 贴给你看好了-3-
排得很乱...但是你整理一下 应该就可以了 还未测试过..
#include <amxmodx>
#include <fun>
#include <cstrike>
new Cvar_BlockKill
new g_gun[33]
public plugin_init()
{
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_clcmd( "Gunmenu","Gunmenu");
}
public event_round_start()
{
for (new id = 1; id <= get_players(); id++)
{
if (!is_user_connected(id)) continue;
g_gun[id] = 0
}
}
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[1024]
vformat(msg, 1023, input, 3)
replace_all(msg, 1023, "/g", "^4")
replace_all(msg, 1023, "/y", "^1")
replace_all(msg, 1023, "/ctr", "^3")
if (id)
players[0] = id
else
get_players(players, count, "ch")
for (new i = 0;i < count;i++)
{
if (is_user_connected(players))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
write_byte(players)
write_string(msg)
message_end()
}
}
}
public Gunmenu(id)
{
if(g_gun[id] < 1 )
{
new menu = menu_create("\r枪械选单", "menu_handler1");
menu_additem(menu, "\yAK47", "1",0);
menu_additem(menu, "\yM4A1", "2", 0);
menu_additem(menu, "\yAWP", "3", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
else
{
client_printcolor(id,"你已选择枪械!")
}
return PLUGIN_HANDLED;
}
public menu_handler1(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(!g_gun[id])
{
strip_user_weapons(id)
give_item(id,"weapon_ak47")
give_item(id,"weapon_deagle")
g_guns[id] ++
menu_destroy(menu)
client_printcolor(id,"/g【系统】已获得枪械 /ctrAK47")
}
else client_printcolor(id,"/g【系统】你已选择枪械")
return PLUGIN_HANDLED
}
case 2:
{
if(!g_gun[id] )
{
client_printcolor(id,"/g【系统】已获得枪械 /ctrM4A1")
strip_user_weapons(id)
give_item(id,"weapon_m4a1")
give_item(id ,"weapon_deagle")
g_guns[id]++
menu_destroy(menu)
}
else client_printcolor(id,"/g【系统】你已选择枪械")
return PLUGIN_HANDLED
}
case 3:
{
if(!g_gun[id])
{
client_printcolor(id,"/g【系统】已获得枪械 /ctrAWP")
strip_user_weapons(id)
give_item(id,"weapon_awp")
give_item(id,"weapon_deagle")
g_guns[id]++
menu_destroy(menu)
}
else client_printcolor(id,"/g【系统】你已选择枪械")
return PLUGIN_HANDLED
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
}