AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to get user Flags (https://forums.alliedmods.net/showthread.php?t=215879)

Jhob94 05-13-2013 13:06

How to get user Flags
 
Hi
I am not asking how to get user flags like ADMIN_LEVEL_H but flag "t"
And if possible, get more then one flag at same time, example "bt"

Bugsy 05-13-2013 13:33

Re: How to get user Flags
 
Quote:

Originally Posted by Jhob94 (Post 1951232)
Hi
I am not asking how to get user flags like ADMIN_LEVEL_H but flag "t"
And if possible, get more then one flag at same time, example "bt"

PHP Code:

new szFlags26 ];
GetLetterFlagsid szFlags charsmaxszFlags ) );
server_printszFlags ); 

PHP Code:


GetLetterFlags
id szFlags[] , iMaxLen )
{
    new 
iFlags get_user_flagsid ) , iStartFlag 'a' iIndex;
    
    for ( new 
< ( 'z' 'a' ) ; i++ )
    {
        if ( 
iFlags & ( << ) )
        {
            
szFlagsiIndex++ ] = iStartFlag i;
        }
        
        if ( 
iIndex == iMaxLen )
            break;
    }
    
    return 
iIndex;



Jhob94 05-13-2013 13:35

Re: How to get user Flags
 
Can you give example?
I think i know +/- how to do but i dont want to make it wrong :3

Bugsy 05-13-2013 13:36

Re: How to get user Flags
 
Quote:

Originally Posted by Jhob94 (Post 1951242)
Can you give example?
I think i know +/- how to do but i dont want to make it wrong :3

Example of what ?

Jhob94 05-13-2013 13:40

Re: How to get user Flags
 
how to use GetLetterFlags

Bugsy 05-13-2013 13:49

Re: How to get user Flags
 
Look at my post, I included an example.

Jhob94 05-13-2013 13:52

Re: How to get user Flags
 
Omfg xD
Sorry :3


EDIT:
Sorry if i didnt said clean what i want.
I want check if user has flags, not if him flags are exactly that.
How i can do if szFlags contain VIP_FLAGS_ACESS (#define VIP_FLAGS_ACESS "t" // VIP Flags (default:t - ADMIN_LEVEL_H))

Bugsy 05-13-2013 14:21

Re: How to get user Flags
 
?

PHP Code:

const VIP_FLAGS_ACCESS ADMIN_LEVEL_H;

if ( 
get_user_flagsid ) & VIP_FLAGS_ACCESS )
{
     
//user has flag
}

//or you can include multiple flags
const VIP_FLAGS_ACCESS ADMIN_LEVEL_C ADMIN_LEVEL_H;

if ( ( 
get_user_flagsid ) & VIP_FLAGS_ACCESS ) == VIP_FLAGS_ACCESS )
{
     
//user has flags



Jhob94 05-13-2013 14:33

Re: How to get user Flags
 
Thats the problem... I use flags as "t" etc not ADMIN_LEVEL_H etc

dFF 05-13-2013 14:38

Re: How to get user Flags
 
PHP Code:

if( has_flagid"t" ) )
{
    
// code
}

if( 
has_all_flagsid"bt" ) )
{
    
// code




All times are GMT -4. The time now is 16:23.

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