AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved how to get two admin access? (https://forums.alliedmods.net/showthread.php?t=335409)

Nutu_ 12-02-2021 12:54

how to get two admin access?
 
PHP Code:

        if(!(get_user_flags(id) & ADMIN_LEVEL_H)) {
            
CromChat(0"!w Admin!g [%s]!w moved an object after build time."adminname)
        }
        else {
            
CromChat(0"!w VIP!g [%s]!w moved an object after building time."adminname)
        } 

I have this, but what i wanted to do is, that people that has ADMIN_LEVEL_H will appear as VIP [%s] bla bla and people that has ADMIN_KICK, will get Admin [%s] bla bla
but in my code, people that have both, get that VIP message!
How can i do that people with admin level h get VIP moved after time, people with admin kick will get admin moved after time and people with both will get admin moved after time, since there are admins with vip flag!
Thank you!

fysiks 12-02-2021 21:19

Re: how to get two admin access?
 
You just need to add the condition that VIP is only given to those with ADMIN_LEVEL_H and not ADMIN_KICK. To make it more comprehensible, I would flip the if statement logic (never do "if not" if you're also going to have an else statement, it makes it hard to read and understand).

One way to do this is like so:

PHP Code:


if( get_user_flags(id) & (ADMIN_LEVEL_H ADMIN_KICK) == ADMIN_LEVEL_H )
{
    
CromChat(0"!w VIP!g [%s]!w moved an object after building time."adminname)
}
else
{
    
CromChat(0"!w Admin!g [%s]!w moved an object after build time."adminname)



Nutu_ 12-03-2021 11:37

Re: how to get two admin access?
 
thanks, it worked!


All times are GMT -4. The time now is 15:31.

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