Ive tryed to add custom sound and make the countdown only apper to CT but it wont work!
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>
#include <dhudmessage>
new const VERSION[] = "1.0"
#define RESPAWN_INTERVAL 15.0
#define TASKID 1996
new contagem_1[] = "sound/Contagem/1.mp3"
new contagem_2[] = "sound/Contagem/2.mp3"
new contagem_3[] = "sound/Contagem/3.mp3"
new contagem_4[] = "sound/Contagem/4.mp3"
new contagem_5[] = "sound/Contagem/5.mp3"
new contagem_6[] = "sound/Contagem/6.mp3"
new contagem_7[] = "sound/Contagem/7.mp3"
new contagem_8[] = "sound/Contagem/8.mp3"
new contagem_9[] = "sound/Contagem/9.mp3"
new contagem_10[] = "sound/Contagem/10.mp3"
public plugin_precache()
{
precache_generic(contagem_1);
precache_generic(contagem_2);
precache_generic(contagem_3);
precache_generic(contagem_4);
precache_generic(contagem_5);
precache_generic(contagem_6);
precache_generic(contagem_7);
precache_generic(contagem_8);
precache_generic(contagem_9);
precache_generic(contagem_10);
}
new bool:b_CanRespawn
new iVictim
const iCountTime = 15;
new g_iCountdownEntity;
new g_iCounter;
public plugin_init()
{
register_plugin( "Time Respawn", VERSION, "Wrecked" ) // :avast:
g_iCountdownEntity = create_entity( "info_target" );
entity_set_string( g_iCountdownEntity , EV_SZ_classname , "countdown_entity" );
register_think( "countdown_entity" , "fw_CountdownEntThink" );
register_event( "HLTV", "EVENT_NewRound", "a", "1=0", "2=0" )
register_event( "HLTV", "ShowCountdown", "a", "1=0", "2=0" )
register_event( "DeathMsg", "EVENT_DeathMsg", "a" )
}
public EVENT_NewRound()
{
remove_task( iVictim )
remove_task( TASKID )
set_task( RESPAWN_INTERVAL, "TASK_SetBool", TASKID )
b_CanRespawn = true
}
public TASK_SetBool()
{
b_CanRespawn = false
}
public EVENT_DeathMsg()
{
iVictim = read_data( 2 )
if( b_CanRespawn )
{
set_task( 0.5, "TASK_Revive", iVictim )
}
}
public TASK_Revive( id )
{
if( !is_user_alive( id ) )
{
ExecuteHamB( Ham_CS_RoundRespawn, id )
}
}
public ShowCountdown()
{
g_iCounter = iCountTime;
entity_set_float( g_iCountdownEntity , EV_FL_nextthink , get_gametime() + 1.0 );
}
public fw_CountdownEntThink( iEntity )
{
if ( iEntity == g_iCountdownEntity )
{
switch( cs_get_user_team( id ) )
{
case CS_TEAM_CT:
{
set_dhudmessage( random( 256 ), random( 256 ), random( 256 ), -1.0, 0.5 , 0 , 0.1 , 0.1 );
show_dhudmessage( 0 , "Ainda podes renascer em: %d segundos" , --g_iCounter );
show_hudmessage(0,"Ainda podes renascer em: %d segundos" , --g_iCounter );
new temp[64]
num_to_word(g_iCounter, temp, charsmax(temp))
client_cmd(0,"speak ^"sound/%s^"", temp)
if ( g_iCounter )
entity_set_float( g_iCountdownEntity , EV_FL_nextthink , get_gametime() + 1.0 );
}
}