AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   admin flag a only (https://forums.alliedmods.net/showthread.php?t=232801)

OOE 01-05-2014 03:35

admin flag a only
 
Hi can someone code in this code here (its a part of a huge plugin) that only Admins with admin flag A can open the blockmaker pls

PHP Code:

public CmdMainMenu(id)
{
    
ShowMainMenu(id);
    return 
PLUGIN_HANDLED;



Kia 01-05-2014 03:50

Re: admin flag a only
 
if(! (get_user_flags(id) & ADMIN_KICK))
return PLUGIN_HANDLED

OOE 01-05-2014 03:51

Re: admin flag a only
 
Can u post the code pls kia

Kia 01-05-2014 03:56

Re: admin flag a only
 
I just did that.
Just put it at the top of your function.

OOE 01-05-2014 16:20

Re: admin flag a only
 
Well you're wrong :D This is what I want!
PHP Code:

public CmdMainMenu(id

    if(
access(idADMIN_IMMUNITY) )
    {
         
ShowMainMenu(id); 
         return 
PLUGIN_HANDLED
     }



Kia 01-05-2014 16:36

AW: Re: admin flag a only
 
Quote:

Originally Posted by OOE (Post 2081679)
Well you're wrong :D This is what I want!
PHP Code:

public CmdMainMenu(id

    if(
access(idADMIN_IMMUNITY) )
    {
         
ShowMainMenu(id); 
         return 
PLUGIN_HANDLED
     }



My code is doing the same (I just had other Flag).

fysiks 01-05-2014 16:49

Re: admin flag a only
 
Quote:

Originally Posted by OOE (Post 2081679)
Well you're wrong :D This is what I want!
PHP Code:

public CmdMainMenu(id

    if(
access(idADMIN_IMMUNITY) )
    {
         
ShowMainMenu(id); 
         return 
PLUGIN_HANDLED
     }



Unless you use ADMIN_ADMIN or ADMIN_ALL, your code is exactly the same thing but less efficient. So, if there is a chance that you might change it to one of these two flags then your code is the best way to go.

fysiks 01-05-2014 16:50

Re: admin flag a only
 
Quote:

Originally Posted by OOE (Post 2081679)
Well you're wrong :D This is what I want!
PHP Code:

public CmdMainMenu(id

    if(
access(idADMIN_IMMUNITY) )
    {
         
ShowMainMenu(id); 
         return 
PLUGIN_HANDLED
     }



Unless you use ADMIN_ADMIN or ADMIN_ALL, your code is exactly the same thing. But, if there is a chance that you might change it to one of these two flags then your code is the best way to go.

OOE 01-05-2014 18:21

Re: admin flag a only
 
i just tryed kias code and it doenst worked and this one works, so fysiks can u post the code with the best way pls?

fysiks 01-05-2014 18:34

Re: admin flag a only
 
If you code works, then use it. I never said it was bad. access() is generally used when the flag being used is unknown at compile time.


All times are GMT -4. The time now is 20:28.

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