bool IsDigited = false; // в начале плагина
bool __stdcall Hook(stRakNetHookParams *hook)
{
if (hook->packetId == RPC_ScrClientMessage)
{
DWORD color, strLen; char msg[256];
hook->bitStream->ResetReadPointer();
hook->bitStream->Read(color);
hook->bitStream->Read(strLen);
hook->bitStream->Read(msg, strLen);
hook->bitStream->ResetReadPointer();
char *ptr = strstr(msg, "Садись уебок");
if (ptr != nullptr) IsDigited = true;
}
}
void __stdcall mainloop( void )
{
static bool init = false;
if( !init )
{
if (GAME == nullptr) return;
if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME) return;
if(!SF->getSAMP()->IsInitialized()) return;
SF->getRakNet()->registerRakNetCallback(RakNetScriptHookType::RAKHOOK_TYPE_INCOMING_RPC, Hook);
init = true;
}
else
{
if (SF->getGame()->isKeyPressed(70) && isDigited)
{
isDigited = false;
// действие
}
}
}