|
大神看看,菜单写对了吗?指定玩家不正确,乱指定呀!!!!
一下是编写的
#include <amxmodx>
#include <amxmisc>
new players[32], pnum, tempid;
public plugin_init()
{
register_clcmd("cktmenu", "CClientMenu");
register_menucmd(register_menuid("\y Function selection :"), 1023, "MenCommand" )
return PLUGIN_CONTINUE
}
////////////////////////////////////////////////////////////////////////////////////////////
public CClientMenu(id)
{
new menu = menu_create("\y --- Cmd Client Menu --- ", "ShowoperationMenu");
new szName[32], szTempid[10];
get_players(players, pnum);
for(new i; i<pnum; i++ )
{
tempid = players[i];
get_user_name(tempid, szName, 31);
num_to_str(tempid, szTempid, 9);
menu_additem(menu, szName, szTempid, ADMIN_IMMUNITY);
}
menu_display(id, menu, 0);
}
public ShowoperationMenu(id, menu, item)
{
if(item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new szMenuBody[512]
new keys
new nLen = format( szMenuBody, 511, "\y --Function selection :^n" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w 1. jia xue " )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w 2. jai qian " )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w 3. gei qiang" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. Exit" )
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)
show_menu( id, keys, szMenuBody, -1 )
return PLUGIN_CONTINUE
}
public MenCommand( id, key )
{
new szName[32];
get_players(players, pnum);
switch( key )
{
case 0: {
server_cmd("amx_heal #%i 50",get_user_userid(tempid));
}
case 1: {
server_cmd("amx_givemoney #%i 1000", get_user_userid(tempid));
}
case 2: {
server_cmd("amx_weapon #%i 43 ", get_user_userid(tempid));
}
case 9: {
client_print( id, print_chat, "[ Exit ]" )
}
}
return PLUGIN_HANDLED
} |
|