Hi. i have This Code. But The problem is that when you select a player, the code does not work on it. The code actually works on the person who opened the menu. Help me.
Thanks And Sorry For my Bad English.
PHP Code:
#include <amxmodx>
#include <colorchat>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <fun>
#define PLUGIN "cc"
#define VERSION "1.0"
#define AUTHOR "mmd"
new szName[33], szPlayerName[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /cc", "cc");
}
public cc(id)
{
if(!(get_user_flags(id) & ADMIN_IMMUNITY))
{
ColorChat(id, RED, "You Dont Have Access");
return PLUGIN_HANDLED;
}
new menu = menu_create("\yMake", "cc2_handler");
menu_additem(menu, "\wBrow", "1", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public cc2_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:
{
brow(id);
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public brow(id)
{
new menu = menu_create ("Players", "brow_handler")
new num, players[32], tempid, szTempID [10], tempname [32]
get_players (players, num, "a")
for (new i = 0; i < num; i++)
{
tempid = players [ i ]
get_user_name (tempid, tempname, 31)
num_to_str (tempid, szTempID, 9)
menu_additem (menu, tempname, szTempID, 0)
}
menu_display (id, menu)
return PLUGIN_HANDLED
}
public brow_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], name[64]
new access, callback, UserID
menu_item_getinfo (menu, item, access, data, 5, name, 63, callback)
new tempid = str_to_num(data)
get_user_name(id, szName, 32)
get_user_name(tempid, szPlayerName, 32)
UserID = get_user_userid(tempid)
return PLUGIN_CONTINUE
}