AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with menus (https://forums.alliedmods.net/showthread.php?t=127478)

#8 SickneSS 05-21-2010 15:42

Problem with menus
 
I have made a menus and 1 of them have a submenu,so i put...


PHP Code:

case :
{
        
Submenu(id);


PHP Code:

Submenu (id)
{
       
//Menu's things
}

//Handler

if(item == MENU_EXIT)
{
    
menu_destroy(Menu);
    
         if(
is_user_connected(id))
                
1stMenu(id);
    return 
PLUGIN_HANDLED;


When i try to compile,this send me this error
Code:

Error: Number of arguments does not match definition on line 802
But 1stMenu,i'ts just for admins (all menus are just for admins)...so i use
public 1stMenu(id,level,cid)

I tried to put 1stMenu(id,level,cid) (to send back to 1stMenu)
But when i put that,compiler shows Undefined simbol : level,Undefined simbol : cid....
How i can make this?

btw I'm ussing amxmisc.inc

wrecked_ 05-21-2010 15:47

Re: Problem with menus
 
You don't need that shit for level and cid. I don't know what you're doing, exactly, but here's an alternative.

Code:
if( !( get_user_flags( id ) & YOUR_ADMIN_FLAG ) ) {     return; }

#8 SickneSS 05-21-2010 16:23

Re: Problem with menus
 
thanks!

fysiks 05-21-2010 17:12

Re: Problem with menus
 
This is how I would do it:

PHP Code:

public cmdFunction(idlevelcid)
{
    if( !
cmd_access(idlevelcid1) )
    {
        return 
PLUGIN_HANDLED
    
}
    
    
ShowMainMenu(id)
}

ShowMainMenu(id)
{
    
// ...
}

public 
MainMenuHandler(...)
{
    
// ...
}

ShowSubMenu(id)
{
    
// ...
}

public 
SubMenuHandler(...)
{
    
// ...
    
case # { ShowMainMenu(id); }



Quote:

Originally Posted by wrecked_ (Post 1187093)
You don't need that shit for level and cid. I don't know what you're doing, exactly, but here's an alternative.

Code:
if( !( get_user_flags( id ) & YOUR_ADMIN_FLAG ) ) {     return; }

If you do it this way you can't change access flag.

To avoid using cmd_access() and still get do (and still be able to change it in cmdaccess.ini):

PHP Code:

function(idlevel)
{
    if( !(
get_user_flags(id) & level) )
    {
        return 
PLUGIN_HANDLED
    
}



#8 SickneSS 05-21-2010 17:14

Re: Problem with menus
 
Thanks,i tried with get_user_flags,and make some problems,so,i use that :),Thanks!


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

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