View Single Post
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 07-31-2010 , 14:12   Re: Help with Optimization!
Reply With Quote #23

Quote:
Originally Posted by Bugsy View Post
If you are using multiple flags and want to use switch(), you can do:
PHP Code:
    //Set both Glow and Gravity powers on player
    
SetFlagid Glow Gravity );
    
    switch ( 
g_WeaponFlagsid ] )
    {
        case ( 
Glow ): //Called if player has ONLY glow power
        
case ( Gravity ): //Called if player has ONLY gravity power
        
case ( Glow Gravity ): //Called since player has both flags. Cant have any other, though.
        
default: 
    }
    
    
ClearFlagsid );

    
//You can also remove flag(s) for the switch statement comparison:
    
    //Below is how to do so with multiple flags:
    
g_WeaponFlagsid ] & ~( Freeze Explode Crush );

    
//Set flags for player.
    
SetFlagid Freeze Glow Gravity );

    
//This will eliminate only the Freeze flag for this comparison
    
switch ( g_WeaponFlagsid ] & ~Freeze )
    {
        case ( 
Glow ): 
        case ( 
Gravity ): 
        case ( 
Glow Gravity ): //this code will be called
        
default:
    } 
simple , awesome , really thanks , + for you.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94