Thread: Loop And Menu
View Single Post
Author Message
Awesome_man
Senior Member
Join Date: May 2014
Location: singapore
Old 12-29-2018 , 11:18   Loop And Menu
Reply With Quote #1

What's wrong with this code i'm trying to loop through all alive terrorist player and add them on menu then adding gOn[tempid] = true; on that particular terrorist selected in menu

PHP Code:
public hu()
{
    
    new 
menu menu_create("Menu","h_handler");
    new 
name[32],text[32]
    
    new 
Players[32]  
    new 
playerCountiszTempid,player  
    get_players
(PlayersplayerCount"che","TERRORIST" )  
    for (
i=0i<playerCounti++) 
    { 
        
player Players[i]  
    

        
get_user_name(playername31
    
num_to_strplayerszTempid)  

        
format(text31"%s - %s"name
        
menu_additemmenunameszTempid);
    }; 

 
    
menu_display(humenu0)     
    return 
PLUGIN_HANDLED;
}   
   
public 
h_handler(id,menu,item)
{
if( 
item == MENU_EXIT )
    {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }
    new 
data], iName64 ];
    new 
accesscallback;
    
menu_item_getinfomenuitemaccessdata,5iName63callback );

    new 
tempid str_to_numdata );
    if( !
is_user_bottempid ) )
        
gOn[tempid] = true;
    
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;


Last edited by Awesome_man; 12-29-2018 at 11:20.
Awesome_man is offline