Raised This Month: $ Target: $400
 0% 

Switch


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-28-2007 , 10:21   Re: Switch
Reply With Quote #5

To avoid to repeat code with a 'case 3:' , I will do that :

Something like :

Quote:
mesaje_mode < flags > : Show messages. Flags are additives.

a : Chat
b : HUD

Default value : "ab".

Before plugin_init() :

Code:
    #define CHAT_MSG ( 1 << 0 ) // a     #define HUD_MSG  ( 1 << 1 ) // b         new p_mesaje_mode;

Into plugin_init() :

Code:
    p_mesaje_mode = register_cvar( "mesaje_mode", "ab" );

Into your function :

Code:
    new flag = get_flags();         // Flag "a"     if( flag & CHAT_MSG )         ColorChat( player, RED, "Ai Scapat Bomba... Ratatule..." );         // Flag "b"     if( flag & HUD_MSG )     {         set_hudmessage( random( 255 ), random( 255 ), random( 255 ), 0.32, 0.26, 0, 6.0, 12.0 );         show_hudmessage( 0, "%s A Scapat Bomba... Ce Ratat....", name );     }

And this small stock to retrieve flags :

Code:
    stock get_flags()     {         static sFlags[4];         get_pcvar_string( p_mesaje_mode, sFlags, sizeof sFlags - 1 );         return read_flags( sFlags );     }

I like this way. Did you understand this idea?
__________________

Last edited by Arkshine; 08-28-2007 at 10:29.
Arkshine is offline
 



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 16:16.


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