SnoW
That was just an example, i use everything you said in ZP_CS_Buymenu
limeassist
yeah, forgot num_to_str works different in c++ and pawn. this one tested.
PHP Code:
new const ACCESS_FLAG = ADMIN_BAN; //level of access needed to use command
new g_players; //amount of player slots on your server
public plugin_init()
{
//blablalbla
g_players = get_maxplayers()
register_clcmd("admin_snapshot_menu", "clcmd_admin_snapshot_menu", ACCESS_FLAG) //register client command
}
public clcmd_admin_snapshot_menu(id,level, cid)
{
if (!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED;
new strtemp1[32]
new strtemp2[2]
new snapmenu = menu_create("Snapshot player:","snap_handle")
for (new i = 1; i <= g_players; i++)
if (is_user_alive(i))
{
get_user_name(i,strtemp1,32);
num_to_str(i,strtemp2,2);
menu_additem(snapmenu, strtemp1,strtemp2);
}
menu_display(id, snapmenu, 0);
}
public snap_handle(id, menu, item, level, cid)
{
new cmd[32];
new access, callback; //tempvar, unused
menu_item_getinfo(menu, item, access, cmd,2,_,_, callback); //put selected player id in cmd
new selectedplayerid = str_to_num(cmd);
if (!is_user_alive(selectedplayerid)) return PLUGIN_HANDLED;
playerss(id, level, cid);
return PLUGIN_HANDLED;
}
__________________