Here there is a plugin (I wrote myself) it reproduces sounds: multikill, megakill and other.
For example:
I killed 3 players and play sound
multikill.
I killed 3 more players and play sound
megakill.
I killed 3 more players and play sound
ultrakill.
I killed 3 more players and play sound
godlike.
But the problem is that if I killed 3 players, and then a further 3 plays sound
godlike. ie passes 2 audio,
megakill and
ultrakill.
What's the problem?
Code:
#include <amxmodx>
#include <csx>
#include <cstrike>
new g_streakKills[33][1]
new g_Sounds[10][] =
{
"multikill",
"megakill",
"ultrakill",
"godlike",
"rampage",
"wickedsick",
"killingspree",
"unstoppable",
"monsterkill",
"ludacrisskill"
}
public plugin_init()
{
register_plugin("Music Stats", "2.0", "Sutar")
}
public client_putinserver(id)
g_streakKills[id] = {0}
public client_death(killer, victim, wpnindex, hitplace, TK)
{
if(wpnindex == CSW_C4)
return
new headshot = (hitplace == HIT_HEAD) ? 1 : 0;
new selfkill = (killer == victim) ? 1 : 0;
if(!TK && !selfkill && killer)
{
g_streakKills[victim][0] = 0;
g_streakKills[killer][0] += 1;
new a = g_streakKills[killer][0] - 3;
if((a > -1) && !(a % 3))
{
if(a > 9)
a = 5;
new file[32]
format(file, 31, "misc/%s", g_Sounds[a])
play_sound(file)
return
}
}
return
}
public play_sound(sound[])
{
new players[32], pnum
get_players(players, pnum, "c")
for(new i = 0; i < pnum; i++)
{
if(is_user_connecting(players[i]))
continue
client_cmd(players[i], "spk %s", sound)
}
}