I have a menu where all online players are shown, and when i select one instead of executing the function into him, its executed on all players... how do i solve this?
heres the code
PHP Code:
public regalar(id){
new temp1[32]
new temp2[2]
new Menu = menu_create("XXXX:","regalarhndlr")
for (new i = 1; i <= get_maxplayers(); i++)
{
if (is_user_connected(i))
{
get_user_name(i,temp1,32);
num_to_str(i,temp2,2);
menu_additem(Menu, temp1,temp2);
}
}
menu_display(id, Menu, 0);
}
public regalarhndlr(id, Menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(Menu)
return PLUGIN_HANDLED
}
new iData[6];
new iAccess;
new iCallback;
new iName[64];
static name[33]
get_user_name(id, name, sizeof name -1)
menu_item_getinfo(Menu, item, iAccess, iData, 5, iName, 63, iCallback)
if(cs_get_user_money(id) >= 5000)
{
cs_set_user_money(id, cs_get_user_money(id) - 5000)
client_print(id,print_chat,"XXXX %s", iName)
for (new i = 1; i <= get_maxplayers(); i++)
{
if (is_user_connected(i))
{
client_print(i, print_chat, "%s XXXX",name)
funcion[i]++
}
}
}
else
client_print(id, print_center, "No tienes suficiente dinero")
return PLUGIN_HANDLED
}
__________________