Raised This Month: $ Target: $400
 0% 

Switch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vl@d
Senior Member
Join Date: Dec 2006
Location: Romania
Old 08-28-2007 , 09:56   Switch
Reply With Quote #1

I need a confirmation about switch.
this code:
Code:
switch(get_pcvar_num(mesaje_mode)){
        case 1:{
        ColorChat(player, RED, "Ai Scapat Bomba... Ratatule...");
        } 
        case 2:{    
        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)
            }
        }
    }
I need to know if the cvar mesaje_mode is set to 3 it will show to both colorchat and the hud.
__________________


I hate Spammers....
vl@d is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-28-2007 , 09:59   Re: Switch
Reply With Quote #2

If set to 3, nothing is happened.
__________________
Arkshine is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-28-2007 , 10:00   Re: Switch
Reply With Quote #3

If cvar mesaje_mode is set to 3 the plugin is showing..."nothing" !

@arkshine - Omg >.> ! second topic i was beated
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
vl@d
Senior Member
Join Date: Dec 2006
Location: Romania
Old 08-28-2007 , 10:04   Re: Switch
Reply With Quote #4

damn. that means i have to make another case with the hud and colrochat
ok thx.
__________________


I hate Spammers....
vl@d is offline
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
vl@d
Senior Member
Join Date: Dec 2006
Location: Romania
Old 08-28-2007 , 11:50   Re: Switch
Reply With Quote #6

ooo yes this is much simpler
thx.
P.S. this event register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4")

Is there a similer event for it, because the hud shows at the round start
__________________


I hate Spammers....
vl@d 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 16:17.


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