Raised This Month: $ Target: $400
 0% 

Show menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 06-04-2009 , 15:19   Show menu
Reply With Quote #1

I have an admin menu with certain privileges, how do I make it accessible only three rounds after the map starts?
Debesėlis is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-04-2009 , 15:33   Re: Show menu
Reply With Quote #2

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.
__________________
fysiks is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 06-04-2009 , 15:36   Re: Show menu
Reply With Quote #3

maybe some example?
Debesėlis is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-04-2009 , 15:44   Re: Show menu
Reply With Quote #4

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.
__________________

Last edited by fysiks; 06-04-2009 at 15:48.
fysiks is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 06-04-2009 , 16:32   Re: Show menu
Reply With Quote #5

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?
Debesėlis is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-04-2009 , 16:36   Re: Show menu
Reply With Quote #6

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).
__________________
fysiks is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 06-04-2009 , 16:39   Re: Show menu
Reply With Quote #7

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...
Debesėlis is offline
Reply



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 13:51.


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