// ...
// Send command to show time
SF->getSAMP()->getPlayers()->pLocalPlayer->Say("/time");
// ...
// This is the function that hooks RakNet. (Packets, RPC, etc.)
bool __stdcall incoming_rpc(stRakNetHookParams * params)
{
if (params->packetId == ScriptRPCEnumeration::RPC_ScrDisplayGameText)
{
DWORD style;
DWORD time;
DWORD strlen;
char string[2048];
params->bitStream->ResetReadPointer();
params->bitStream->Read(style);
params->bitStream->Read(time);
params->bitStream->Read(strlen);
params->bitStream->Read(string, strlen);
// Next, work with the string variable and get time from it
}
return true;
}
// ...
// This is a hook registration, it is done in the main loop once, i.e. she should stand somewhere in if(!init), after the initialization of the game of course
SF->getRakNet()->registerRakNetCallback(RakNetScriptHookType::RAKHOOK_TYPE_INCOMING_RPC, incoming_rpc);