AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Show menu (https://forums.alliedmods.net/showthread.php?t=93936)

Debesėlis 06-04-2009 15:19

Show menu
 
I have an admin menu with certain privileges, how do I make it accessible only three rounds after the map starts?

fysiks 06-04-2009 15:33

Re: Show menu
 
Add a variable to count the number of rounds that have been started then check that in your admin command fucntion. If it's not enough return PLUGIN_HANDLED.

Debesėlis 06-04-2009 15:36

Re: Show menu
 
maybe some example?

fysiks 06-04-2009 15:44

Re: Show menu
 
1. Register the new round event.
2. In that functions add 1 to the round count variable.
3. In your admin command function, check if your round count variable is greater than 3 (or greater than or equal to 3). If not true then return PLUGIN_HANDLED.

Semi-pseudo code :):

PHP Code:

new g_iRoundCount 0

public plugin_init()
{
    
// ....
    // Register NewRound to call function eventNewRound
    // ....
}

public 
eventNewRound()
{
    
g_iRoundCount++
}

public 
my_admin_command(id,level,cid)
{
    if(
g_iRoundCount 3)
    {
        return 
PLUGIN_HANDLED
    
}

    
// ....


Also, you could register the round end log event and increment there instead.

Debesėlis 06-04-2009 16:32

Re: Show menu
 
PHP Code:

    if(g_iRoundCount 2)
    {
        
client_print(idprint_chat"You Must wait for 2 rounds!")
        return 
PLUGIN_HANDLED
    
}

    if(
g_iRoundCount 2)
    {
        
client_print(idprint_chat"Now you can use menu!")
    } 

When rounds > 2 message not shows :| how to do that after 2 round show message that can use menu?

fysiks 06-04-2009 16:36

Re: Show menu
 
You want to show a message to all the players that the menu is available? You can do that in the newround/endround event (if the required number of rounds has passed).

Debesėlis 06-04-2009 16:39

Re: Show menu
 
i want to show message only for player who have acces to menu...
PHP Code:

    if(g_iRoundCount 2)
    {
        
client_print(idprint_chat"You Must wait for 2 rounds!")
        return 
PLUGIN_HANDLED
    


This works fine...


All times are GMT -4. The time now is 13:51.

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