Raised This Month: $ Target: $400
 0% 

Execute function on selected player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sombrilla
Veteran Member
Join Date: Apr 2009
Location: Buenos Aires
Old 08-16-2010 , 15:00   Execute function on selected player
Reply With Quote #1

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 
1<= get_maxplayers(); i++)
    {
        if (
is_user_connected(i))
        {
            
get_user_name(i,temp1,32);
            
num_to_str(i,temp2,2);
            
menu_additem(Menutemp1,temp2);
        }
    }
    
menu_display(idMenu0);  
}

public 
regalarhndlr(idMenuitem)
{
    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(idnamesizeof name -1)
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)
    
    if(
cs_get_user_money(id) >= 5000)
    {
        
cs_set_user_money(idcs_get_user_money(id) - 5000)
        
client_print(id,print_chat,"XXXX %s"iName)  
        for (new 
1<= get_maxplayers(); i++)
        {
            if (
is_user_connected(i))
            {
                
client_print(iprint_chat"%s XXXX",name)  
                
funcion[i]++
            }
        }
    }
    else
        
client_print(idprint_center"No tienes suficiente dinero")
    
    return 
PLUGIN_HANDLED

__________________

sombrilla is offline
Send a message via MSN to sombrilla
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode