AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu help (https://forums.alliedmods.net/showthread.php?t=185244)

Bilal Pro 05-14-2012 15:51

Menu help
 
Hello there,

How can i show a menu to all the players without using a loop?

Ex1ne 05-14-2012 16:00

Re: Menu help
 
PHP Code:

menu_display0menu 


Exolent[jNr] 05-14-2012 16:00

Re: Menu help
 
You can't. Just use the loop.

Bilal Pro 05-14-2012 16:03

Re: Menu help
 
But if im using the loop it will bug, well the timer will.

Exolent[jNr] 05-14-2012 16:05

Re: Menu help
 
Quote:

Originally Posted by Ex1ne (Post 1708911)
PHP Code:

menu_display0menu 


That will throw an error. That function doesn't know to loop through players if you pass 0.

Quote:

Originally Posted by Bilal Pro (Post 1708913)
But if im using the loop it will bug, well the timer will.

Then your code needs to be structured differently. Show your code.

Bilal Pro 05-14-2012 16:15

Re: Menu help
 
PHP Code:

public KickMenu3(idmenuitem)
{    
    if (
item == MENU_EXIT)
    {
        
KickMenu(id)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], name[64], accescallback
    menu_item_getinfo
(menuitemaccesdatacharsmax(data), namecharsmax(name), callback)
    
    
reason str_to_num(data)
    
    
// sound
    
client_cmd(0"spk misc/bilalvote.wav")
    
    
// task
    
set_task(15.0"EndVote")
    
    
// menu
    
KickMenu4(id)
    
    return 
PLUGIN_CONTINUE
}

public 
KickMenu4(id)
{
    
Timer 15
    set_task
(1.0"KickMenu5"TASKID__"a"Timer)
}


public 
KickMenu5(id)
{
    new 
players[32], iNum
    get_players
(playersiNum"ch")
    
    for (new 
i<iNumi++)
    {
        
Timer--
        
        if(
Timer 0
        {
            
KickMenu6(players[i])
        }
        
        if(
Timer == )
        {
            
ColorChat(0GREY"[sG] ^1The ^4vote^1 has ended!")
            
Timer 0
        
}
    }


My timer.

Exolent[jNr] 05-14-2012 16:27

Re: Menu help
 
PHP Code:

public KickMenu5(id)
{
    
Timer--
    
    if(
Timer 0)
    {
        new 
players[32], iNum
        get_players
(playersiNum"ch")
        
        for(new 
0iNumi++)
        {
            
KickMenu6(players[i])
        }
    }
    else
    {
        
ColorChat(0GREY"[sG] ^1The ^4vote^1 has ended!")
    }



Bilal Pro 05-14-2012 16:32

Re: Menu help
 
Whats the difference? :O

Exolent[jNr] 05-14-2012 16:43

Re: Menu help
 
Quote:

Originally Posted by Bilal Pro (Post 1708932)
Whats the difference? :O

The logic and structure. It's actually really obvious what the difference is.

Bilal Pro 05-15-2012 08:14

Re: Menu help
 
Now it presses buttons automatic without touching it.


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

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