hello i have a zombie mod server and on that is a countdown remix from here on allied the coders name i forgot but the problem with plugin is when it counts it counts from 10 zp delay on my server is 10 but it counts 10 and on hudmessage its a 9, 9 is 8 etc and on last 1 it again says 10 here is the code whats wrong with sry for bad englisch
PHP Code:
/*********************************************
==============================================
* Infection Countdown For Zombie Plague 4.3+ *
==============================================
Description:
Remake version of zp_server_addon_countdown
by Mr. Apple, borrowed some code from
bcdhud_timer by SAMURAI
Modules:
- csx (for Countdown HUD Message)
Changelog:
1.0 Initial release
Credits:
- AMXModx Team (AMXModX 1.8.1)
- Mercylezz (Zombie Plague 4.3)
- SAMURAI (bcdhud_timer)
- Mr. Apple (zp_server_addon_countdown)
********************************************/
#include <amxmodx>
#include <csx>
#include <amxmisc>
#include <zombieplague>
#define PLUGIN "[ZP] Infection Countdown"
#define VERSION "1.0"
#define AUTHOR "Dels"
new countdown_timer;
new g_msgsync;
const TASK_ID = 1603;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
//needed for smooth countdown display
g_msgsync = CreateHudSyncObj();
}
public plugin_precache()
{
precache_sound("fvox/ten.wav");
precache_sound("fvox/nine.wav");
precache_sound("fvox/eight.wav");
precache_sound("fvox/seven.wav");
precache_sound("fvox/six.wav");
precache_sound("fvox/five.wav");
precache_sound("fvox/four.wav");
precache_sound("fvox/three.wav");
precache_sound("fvox/two.wav");
precache_sound("fvox/one.wav");
}
public event_round_start()
{
//bugfix
remove_task(TASK_ID);
countdown_timer = get_cvar_num("zp_delay") - 0;
set_task(4.0, "countdown", TASK_ID);
}
public countdown()
{
new speak[10][] = {
"fvox/one.wav",
"fvox/two.wav",
"fvox/three.wav",
"fvox/four.wav",
"fvox/five.wav",
"fvox/six.wav",
"fvox/seven.wav",
"fvox/eight.wav",
"fvox/nine.wav",
"fvox/ten.wav"
}
if (countdown_timer > 1)
{
emit_sound(0, CHAN_VOICE, speak[countdown_timer-1], 1.0, ATTN_NORM, 0, PITCH_NORM);
set_hudmessage(179, 0, 0, -1.0, 0.28, 2, 0.02, 1.0, 0.01, 0.1, 10);
//show_hudmessage(0, "Infection on %i", countdown_timer-1); //old way to display message, little flicker
ShowSyncHudMsg(0, g_msgsync, "Infection on %i", countdown_timer-1); //the new way
}
--countdown_timer;
if(countdown_timer >= 1)
{
set_task(1.0, "countdown", TASK_ID);
}
else
{
emit_sound(0, CHAN_VOICE, speak[9], 1.0, ATTN_NORM, 0, PITCH_NORM);
remove_task(TASK_ID);
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/