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?
__________________