#include <amxmodx>
#include <reapi>
#pragma semicolon 1
new const g_szHegrenSounds[][] = {
"radio/grenade/grenade01.wav",
"radio/grenade/grenade02.wav",
"radio/grenade/grenade03.wav"
};
new const g_szFlashSounds[][] = {
"radio/grenade/flashbang01.wav",
"radio/grenade/flashbang02.wav",
"radio/grenade/flashbang03.wav"
};
new const g_szSmokeSounds[][] = {
"radio/grenade/smoke01.wav",
"radio/grenade/smoke02.wav",
"radio/grenade/smoke03.wav"
};
new const g_szBombSounds[][] = {
"radio/grenade/bomb01.wav",
"radio/grenade/bomb02.wav",
"radio/grenade/bomb03.wav"
};
const g_iMaxSndHe = sizeof(g_szHegrenSounds);
const g_iMaxSndFlash = sizeof(g_szFlashSounds);
const g_iMaxSndSmoke = sizeof(g_szSmokeSounds);
const g_iMaxSndBomb = sizeof(g_szBombSounds);
public plugin_precache() {
for(new i = 0; i < g_iMaxSndHe; i++) {
precache_sound(g_szHegrenSounds[i]);
}
for(new i; i < g_iMaxSndFlash; i++) {
precache_sound(g_szFlashSounds[i]);
}
for(new i = 0; i < g_iMaxSndSmoke; i++) {
precache_sound(g_szSmokeSounds[i]);
}
for(new i = 0; i < g_iMaxSndBomb; i++) {
precache_sound(g_szBombSounds[i]);
}
}
public plugin_init() {
register_plugin("are you trying to get free?", "why?", "you're going to die anyway");
// RG_CBasePlayer_ThrowGrenade?! NO)))
RegisterHookChain(RG_ThrowFlashbang, "refwd_ThrowFlashbang_Post", .post = true);
RegisterHookChain(RG_ThrowHeGrenade, "refwd_ThrowHeGrenade_Post", .post = true);
RegisterHookChain(RG_ThrowSmokeGrenade, "refwd_ThrowSmokeGrenade_Post", .post = true);
RegisterHookChain(RG_PlantBomb, "refwd_PlantBomb_Post", .post = true);
}
public refwd_PlantBomb_Post(pOwner, Float:vecStart[3], Float:vecVelocity[3]) {
func_PlaySound(pOwner, g_szBombSounds[random(g_iMaxSndBomb)]);
}
public refwd_ThrowFlashbang_Post(pPlayer, Float:vecSrc[3], Float:vecVelocity[3], Float:fTime) {
func_PlaySound(pPlayer, g_szFlashSounds[random(g_iMaxSndFlash)]);
}
public refwd_ThrowHeGrenade_Post(pPlayer, Float:vecSrc[3], Float:vecVelocity[3], Float:fTime, team, usEvent) {
func_PlaySound(pPlayer, g_szHegrenSounds[random(g_iMaxSndHe)]);
}
public refwd_ThrowSmokeGrenade_Post(pPlayer, Float:vecSrc[3], Float:vecVelocity[3], Float:time, usEvent) {
func_PlaySound(pPlayer, g_szSmokeSounds[random(g_iMaxSndSmoke)]);
}
func_PlaySound(pPlayer, szSound[]) {
new iPlayers[32], iNum;
get_players(iPlayers, iNum, "ceh", (TeamName:get_member(pPlayer, m_iTeam) == TEAM_CT) ? "CT" : "TERRORIST");
for(new i; i < iNum; i++) {
rh_emit_sound2(pPlayer, iPlayers[i], CHAN_AUTO, szSound, .vol = 0.5, .attn = 0.6);
}
}