AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Simple Menu (Terms of Agreement) (https://forums.alliedmods.net/showthread.php?t=161997)

GXLZPGX 07-13-2011 17:15

Simple Menu (Terms of Agreement)
 
PHP Code:

public client_putinserver(id)
{
    
set_task0.5"show_terms"id )
}

public 
show_terms(id)
{
    new 
menu menu_create("\rTerms of Agreement^n\y-------------^n\
    \w1. Rule One.^n\
    2. Rule Two.^n\
    3. Rule 3.^n\
    4. Rule 4."
"terms_handler")
    
    
menu_additem(menu"I agree""1"0)
    
menu_additem(menu"I disagree \r(You will be kicked!)""2"0)
    
    
menu_display(idmenu0)
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
}

public 
terms_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
show_terms(id)
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfomenuitemaccessdata6iName63callback )
    
    new 
key str_to_numdata );
    
    switch( 
key )
    {
        case 
1:
        {
            
Weapons_Menu(id);
        }
        
        case 
2:
        {
            
client_print(idprint_console"You have been kicked for denying our Terms of Agreement.")
            
client_cmd(id"toggleconsole")
            
client_cmd(id"disconnect")
        }
    }
    
    return 
PLUGIN_HANDLED;


The only issue I seem to be having is with the handler. The menu shows and what not, but none of the options work (exit, agree, disagree)

I've been trying everything I can to fix it, I suppose everything I have isn't enough. Anything you see wrong here?

Note:

5:46 PM ( I ran the menu on player spawn, and it works completely fine. It only has issues with set_task )

nikhilgupta345 07-13-2011 17:28

Re: Simple Menu (Terms of Agreement)
 
Set the menu property before you display the menu.

GXLZPGX 07-13-2011 17:35

Re: Simple Menu (Terms of Agreement)
 
Quote:

Originally Posted by nikhilgupta345 (Post 1510095)
Set the menu property before you display the menu.

That's not going to change anything at all bud, that's how I've always done it, and it has always worked. I have a server currently running with a menu set up exactly the way I showed in my first post, and the server is completely fine.

bibu 07-13-2011 17:55

Re: Simple Menu (Terms of Agreement)
 
Make the task longer. "putinserver" is too early and the engine thinks that the pressed keys are for the team selection menu.

fysiks 07-14-2011 00:05

Re: Simple Menu (Terms of Agreement)
 
Quote:

Originally Posted by GXLZPGX (Post 1510100)
That's not going to change anything at all bud, that's how I've always done it, and it has always worked.

That's because you are setting the property to it's default :). IIRC

GXLZPGX 07-14-2011 01:06

Re: Simple Menu (Terms of Agreement)
 
Quote:

Originally Posted by fysiks (Post 1510257)
That's because you are setting the property to it's default :). IIRC

Because I'm a pro.

The problem was solved anyways, thanks peeps.

Kreation 07-14-2011 01:20

Re: Simple Menu (Terms of Agreement)
 
Quote:

Originally Posted by GXLZPGX (Post 1510287)
Because I'm a pro.

LOL!

Sorry, was that aloud?


All times are GMT -4. The time now is 01:10.

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