Quote:
Originally Posted by Bugsy
If you are using multiple flags and want to use switch(), you can do:
PHP Code:
//Set both Glow and Gravity powers on player SetFlag( id , Glow | Gravity ); switch ( g_WeaponFlags[ id ] ) { 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: } ClearFlags( id );
//You can also remove flag(s) for the switch statement comparison: //Below is how to do so with multiple flags: g_WeaponFlags[ id ] & ~( Freeze | Explode | Crush );
//Set flags for player. SetFlag( id , Freeze | Glow | Gravity );
//This will eliminate only the Freeze flag for this comparison switch ( g_WeaponFlags[ id ] & ~Freeze ) { case ( Glow ): case ( Gravity ): case ( Glow | Gravity ): //this code will be called default: }
|
simple , awesome , really thanks , +
for you.
__________________