Raised This Month: $ Target: $400
 0% 

Reading single char from string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xiiph
Junior Member
Join Date: Mar 2005
Old 03-22-2005 , 14:59   Reading single char from string
Reply With Quote #1

This is what I want to do:
I want to make a script that check if someone is regged on a forum. It will do this by checking for a specific access flag, lets say "n".

And if the server is full, it should kick one of the unregistred players when a registred player try to connect (this should therefore also give access to a reserved slot).

_Any_ other tips that might help me do this is Greaty appreciated. But to the main question:

How do I check the value I get from get_user_flags() (<--- think thats the one with access flags...?) for a specific flag, in this case, "n".

All flags for a normal registred user (not admin, or immune) would be bmn.

All help appreciated, thank you.
xiiph is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-22-2005 , 15:15  
Reply With Quote #2

try containi, contain, or regex.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-22-2005 , 17:05  
Reply With Quote #3

Actually, in this case, you wouldn't search a string.

Code:
#include <amxmisc> .. if(access(id,ADMIN_LEVEL_B)) {    ... }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-22-2005 , 17:09   Re: Reading single char from string
Reply With Quote #4

Quote:
Originally Posted by xiiph
How do I check the value I get from get_user_flags() (<--- think thats the one with access flags...?) for a specific flag, in this case, "n".
From amxconst.inc:
Code:
#define ADMIN_LEVEL_B       (1<<13) /* flag "n" */

So, use:

Code:
if( get_user_flags( id ) & ADMIN_LEVEL_B ) {     // the user 'id' has flag 'n' }

Edit: the access() function that Avalanche posted is the exact same thing as what I wrote above, but it requires you include <amxmisc>

Remember tho, get_user_flags() returns a BitSum of the flags, not actual characters... to convert it to the character flags (and vice-versa), use these from amxmodx.inc:

Code:
/* Converts string to sum of bits. * Example: "abcd" is a sum of 1, 2, 4 and 8. */ native read_flags(const flags[]); /* Converts sum of bits to string. * Example: 3 will return "ab". */ native get_flags(flags,output[],len);

Edit: Avalanche, you posted just b4 me..
xeroblood is offline
Send a message via MSN to xeroblood
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 09:56.


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