Raised This Month: $32 Target: $400
 8% 

Flagbits & Flag Char


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Antithasys
Moderator
Join Date: Apr 2008
Old 09-12-2008 , 00:09   Flagbits & Flag Char
Reply With Quote #1

Anyone know a slick way to read the flag char like "a" or "z" from a string cvar and interpret that to a ADM_FLAG so this statement can be re-written

Code:
if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1) {
And instead of hard coding the flag, I could have it set in a .cfg file using the char references.
Antithasys is offline
Antithasys
Moderator
Join Date: Apr 2008
Old 09-12-2008 , 00:38   Re: Flagbits & Flag Char
Reply With Quote #2

Thank you kindly.
Antithasys is offline
Antithasys
Moderator
Join Date: Apr 2008
Old 09-12-2008 , 00:47   Re: Flagbits & Flag Char
Reply With Quote #3

Tested and it works. +karma. Thanks again!
Antithasys is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 09-12-2008 , 00:58   Re: Flagbits & Flag Char
Reply With Quote #4

Code:
public example(id) {     if(has_flags(id,"acde"))     {         // have "abcde"     } } stock has_flags(id,const String:flags[]) {     new ibFlags = ReadFlagString(flags);     return ((GetUserFlagBits(id) & ibFlags) == ibFlags); }
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 09-12-2008 , 02:22   Re: Flagbits & Flag Char
Reply With Quote #5

Ah, I knew there was another way, but I couldn't remember how to do it. SAMURAI's method is definitely the way to go.
bl4nk is offline
Antithasys
Moderator
Join Date: Apr 2008
Old 09-12-2008 , 02:30   Re: Flagbits & Flag Char
Reply With Quote #6

Ya, I will update my plugin soon.
Antithasys is offline
Antithasys
Moderator
Join Date: Apr 2008
Old 09-18-2008 , 19:29   Re: Flagbits & Flag Char
Reply With Quote #7

This code is so streamlined that it's hard for me to follow. I am sure it's possible, but if someone could help me add a check for root admin it would be very helpful.

Basically some people are setting the flag to "a" and the root admin "z" is not being recognized if they don't also have "a".

Any ideas?
Antithasys is offline
HiJacker
Senior Member
Join Date: Jul 2008
Location: Slovakia
Old 10-01-2008 , 03:39   Re: Flagbits & Flag Char
Reply With Quote #8

For example , this will check person if he has got ROOT or GENERIC flag on connecting , this feature is from ReservedSlots by AM and was used in AdminJoinNotify

PHP Code:
public OnClientPostAdminCheckclient )
{
    if( 
IsFakeClientclient ) )
    return;
    
    if (
flags ADMFLAG_ROOT || flags ADMFLAG_GENERIC)
        {
                   
//do something
        
}

__________________
Before you talk to me, I should warn you : Im kind of strange.

Last edited by HiJacker; 10-02-2008 at 04:24.
HiJacker is offline
Send a message via ICQ to HiJacker
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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