Raised This Month: $ Target: $400
 0% 

How to "switch strings" ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 03-02-2010 , 11:42   How to "switch strings" ?
Reply With Quote #1

Code:
PHP Code:
#include <amxmodx>

public test(id)
{
    new 
flags get_user_flags(id)
    
    switch(
flags)
    {
        case 
"abcd":
        {
            
//..
        
}
        case 
"abcdef":
        {
            
//...
        
}
    }

Any help ?
dFF is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 03-02-2010 , 11:43   Re: How to "switch strings" ?
Reply With Quote #2

Can't do, go with ifs. Your flags seem pretty weird I must say.
SnoW is offline
Send a message via MSN to SnoW
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-02-2010 , 11:49   Re: How to "switch strings" ?
Reply With Quote #3

PHP Code:
#include <amxmodx>

const abcd ADMIN_IMMUNITY|ADMIN_RESERVATION|ADMIN_KICK|ADMIN_BAN
const abcdef abcd|ADMIN_SLAY|ADMIN_MAP

public test(id)
{
    switch( 
get_user_flags(id) )
    {
        case 
abcd:
        {
            
//..
        
}
        case 
abcdef:
        {
            
//...
        
}
    }

case abcdef won't match if user have another flag like flag "g" for example, so this is a really bad idea to use this.

Use rather has_flags or has_all_flags stocks from amxmisc + if / else statements.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
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 08:40.


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