View Single Post
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 03-01-2011 , 09:03   Re: Show Hud Message Color Countdown
Reply With Quote #7

try this, not tested

PHP Code:

#include < amxmodx >
#include < amxmisc >

#pragma semicolon 1

#define MAX_SECONDS    16

enum _iRGB
{
    
r,
    
g,
    
b
};

enum ( += 1337 )
{
    
TASK_ONE,
    
TASK_TWO
};

new const 
gHudColorsMAX_SECONDS ][ iRGB ] =
{
    { 
1920},
    { 
2360},
    { 
25511},
    { 
25532},
    { 
25555},
    { 
255114},
    { 
255150},
    { 
255207},
    { 
255238},
    { 
19423247 },    
    { 
13118996 },
    { 
70160141 },
    { 
32136168 },
    { 
6118183 },
    { 
583154 },
    { 
255255255 }
};

new const 
gSoundsSpeakMAX_SECONDS ][ ] =
{
    
"Evil-Night/Countdown/zero.wav",
     
"Evil-Night/Countdown/one.wav"
     
"Evil-Night/Countdown/two.wav"
     
"Evil-Night/Countdown/three.wav"
     
"Evil-Night/Countdown/four.wav"
     
"Evil-Night/Countdown/five.wav"
     
"Evil-Night/Countdown/six.wav"
     
"Evil-Night/Countdown/seven.wav"
     
"Evil-Night/Countdown/eight.wav",      
    
"Evil-Night/Countdown/nine.wav",
     
"Evil-Night/Countdown/ten.wav",
    
"Evil-Night/Countdown/eleven.wav",
    
"Evil-Night/Countdown/twelve.wav",
    
"Evil-Night/Countdown/thirteen.wav",
    
"Evil-Night/Countdown/fourteen.wav",
    
"Evil-Night/Countdown/fifteen.wav"
};

new 
gCountTimer;
new 
gHudSync;

public 
plugin_init( )
{
    
register_plugin"""""" );
    
    
register_logevent"LOGRoundStart"2"1=Round_Start" );
    
    
gHudSync CreateHudSyncObj( );
}

public 
plugin_precache( )
{
    new 
i;
    for( 
0MAX_SECONDSi++ )
    {
        
precache_soundgSoundsSpeak] );
    }
}

public 
LOGRoundStart( )
{
    
remove_taskTASK_ONE );
    
remove_taskTASK_TWO );
    
    
set_taskfloatMAX_SECONDS ), "RemoveTimerHUD"TASK_ONE__"b" );
    
set_task1.0"ShowCountTimer"TASK_TWO__"a"MAX_SECONDS );
}

public 
ShowCountTimer( )
{
    
gCountTimer++;
    
    new 
iTimer MAX_SECONDS gCountTimer;
    
    
set_hudmessagegHudColorsiTimer ][ ], gHudColorsiTimer ][ ], gHudColorsiTimer ][ ], -1.00.2820.021.00.010.1); 
    
ShowSyncHudMsg0gHudSync"CountDown: %d"iTimer );
    
    if( 
iTimer <= MAX_SECONDS )
    {
        new 
szNumToWord60 ];
        
num_to_wordiTimerszNumToWordcharsmaxszNumToWord ) );
        
        
client_cmd0"speak ^"Evil-Night/Countdown/%s^""szNumToWord );
    }
}

public 
RemoveTimerHUD( )
{
    
remove_taskTASK_ONE );
    
remove_taskTASK_TWO );
    
    
gCountTimer 0;

updated
__________________

Last edited by tuty; 03-01-2011 at 09:37.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty