#include <Windows.h>
#include "main.h"
SAMPFUNCS *SF = new SAMPFUNCS();
bool CALLBACK incomingRPC(stRakNetHookParams *params)
{
if (params->packetId == ScriptRPCEnumeration::RPC_ScrPlaySound) {
DWORD soundId;
params->bitStream->ResetReadPointer();
params->bitStream->Read(soundId);
if (soundId == 1169) return false; // id звука = 1169
}
return true;
};
void __stdcall mainloop()
{
static bool initialized = false;
if (!initialized)
{
if (GAME && GAME->GetSystemState() == eSystemState::GS_PLAYING_GAME && SF->getSAMP()->IsInitialized())
{
initialized = true;
SF->getRakNet()->registerRakNetCallback(RakNetScriptHookType::RAKHOOK_TYPE_INCOMING_RPC, incomingRPC);
}
}
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
{
if (dwReasonForCall == DLL_PROCESS_ATTACH)
SF->initPlugin(mainloop, hModule);
return TRUE;
}