下面是引用 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;
}
}