-
Автор темы
- #1
Код:
int GetRealtime()
{
time_t seconds;
seconds = time(NULL);
return seconds;
}
void KillSound(IGameEvent* event)
{
if (g_Options.misc.killsound)
{
int attacker = g_EngineClient->GetPlayerForUserID(event->GetInt("attacker", 0));
int dead = g_EngineClient->GetPlayerForUserID(event->GetInt("userid", 0));
int me = g_EngineClient->GetLocalPlayer();
bool is_killsound;
int time = 0;
if (attacker == me && dead)
{
g_CVar->FindVar("voice_inputfromfile")->SetValue(1);
g_EngineClient->ExecuteClientCmd("+voicerecord");
g_CVar->FindVar("voice_loopback")->SetValue(1);
g_EngineClient->ExecuteClientCmd("play voice_input.wav");
is_killsound = true;
time = GetRealtime() + 2.f;
}
else if (is_killsound && time < GetRealtime())
{
g_CVar->FindVar("voice_inputfromfile")->SetValue(0);
g_EngineClient->ExecuteClientCmd("-voicerecord");
g_CVar->FindVar("voice_loopback")->SetValue(0);
is_killsound = false;
}
}
}