I have a problem that is harder to explain.
I'm using
infection countdown remix plugin and I tried to make countdown sounds to work for both formats (.wav and .mp3).
Check if format is .mp3, if yes play it, if it's not, it is .wav and play it.
It seems to work except
every other .wav sound is much louder then the other .wav sounds.
It goes like this:
When every .mp3 sound plays, audio volume is normal, if .wav sound plays, for example ten.wav it's much louder then the sound eleven.wav, and eleven.wav has a normal audio volume just like .mp3 has, then after that eight.wav is much louder, just like ten.wav, then again, seven.wav is OK and six.wav is very loud etc...
I have no idea why is that happening.
I
highlighted everything that I have changed from the original plugin and I removed some comments to make the plugin smaller and put it here.
Any solution?
Code:
#include <amxmodx>
#include <csx>
#include <amxmisc>
#include <zombieplague>
#define PLUGIN "[ZP] Infection Countdown Remix"
#define VERSION "1.3"
#define AUTHOR "Dels"
new countdown_timer, cvar_countdown_sound;
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");
register_dictionary("zp_countdown_remix.txt");
//needed for smooth countdown display
g_msgsync =
CreateHudSyncObj();
//cvars
cvar_countdown_sound =
register_cvar("countdown_sound",
"1");
//1 to enable, 0 to disable
}
public plugin_precache
()
{
precache_sound("fvox/biohazard_detected.wav");
precache_sound("fvox/one.wav");
precache_sound("fvox/two.wav");
precache_sound("fvox/three.wav");
precache_sound("fvox/four.wav");
precache_sound("fvox/five.wav");
precache_sound("fvox/six.wav");
precache_sound("fvox/seven.wav");
precache_sound("fvox/eight.wav");
precache_sound("fvox/nine.wav");
precache_sound("fvox/ten.wav");
precache_sound("fvox/beafq7.mp3");
precache_sound("fvox/beafq12.mp3");
precache_sound("fvox/thirteen.wav");
precache_sound("fvox/fourteen.wav");
precache_sound("fvox/fifteen.wav");
}
public event_round_start
()
{
//bugfix
remove_task(TASK_ID
);
countdown_timer =
get_cvar_num("zp_delay") -
1;
set_task(4.0,
"countdown", TASK_ID
);
}
public countdown
()
{
new speak
[16][] =
{
"fvox/biohazard_detected.wav",
"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",
"fvox/beafq7.mp3",
"fvox/beafq12.mp3",
"fvox/thirteen.wav",
"fvox/fourteen.wav",
"fvox/fifteen.wav"
}
if (countdown_timer >
1)
{
if (cvar_countdown_sound !=
0)
{
for(new i = 0; i < sizeof speak; i++)
if (equal(speak[i][strlen(speak[i])-4], ".mp3"))
client_cmd(0, "mp3 play ^"sound/%s^"", speak[countdown_timer-1])
else
client_cmd(0,
"spk %s", speak
[countdown_timer
-1]);
}
set_hudmessage(179,
0,
0,
-1.0,
0.28,
2,
0.02,
1.0,
0.01,
0.1,
10);
if (countdown_timer !=
1)
ShowSyncHudMsg(0, g_msgsync,
"%L", LANG_PLAYER,
"COUNTDOWN_MSG", countdown_timer
-1);
//the new way
}
--countdown_timer;
if(countdown_timer >=
1)
set_task(1.0,
"countdown", TASK_ID
);
else
remove_task(TASK_ID
);
}