bool CALLBACK incomingRPC(stRakNetHookParams * params)
{
if (params->packetId == ScriptRPCEnumeration::RPC_ScrClientMessage)
{
if (translatorEnabled)
{
DWORD color;
DWORD strlen;
char string[2048];
params->bitStream->ResetReadPointer();
params->bitStream->Read(color);
params->bitStream->Read(strlen);
params->bitStream->Read(string, strlen);
string[strlen] = '\0';
//translation part should be here
AddMessageToChat(D3DCOLOR_XRGB(0, 0XAA, 0), "%s", string);
return false;
}
}
return true;
}
void CALLBACK mainloop()
{
static bool init = false;
if (!init)
{
init = true;
SF->getRakNet()->registerRakNetCallback(RakNetScriptHookType::RAKHOOK_TYPE_INCOMING_RPC, incomingRPC);
}
}