void EventListener::OnPlayerDeath( ) {
typedef bool( __cdecl* Voice_RecordStartFn )( const char*, const char*, const char* );
static Voice_RecordStartFn Voice_RecordStart = Voice_RecordStartFn( Utils.FindPattern( "engine.dll", "55 8B EC 83 EC 0C 83 3D ?? ?? ?? ?? ?? 56 57" ) );
const char* WavSound = "MyCustomPathToMyFile.wav"; //не обязательно, сюда можно прописать путь
m_FileDuration = Utils.GetWavFileDuration( WavSound ); //нам нужно получить длину файла, чтобы не сидеть с включенным войсчатом
m_FilePlayEndTime = I::Globals->curtime + m_FileDuration; //логично, получаем сколько включать войсчат
I::Engine->ExecuteClientCmd( "voice_loopback 1" ); //нужно, чтобы ты слышал свой звук (мало ли не работает)
Voice_RecordStart( WavSound, nullptr, nullptr );
}
void EventListener::OnFilePlayEnd( ) {
I::Engine->ExecuteClientCmd( "voice_loopback 0; -voicerecord" ); //выключаем
}