#include "stdafx.h"
#include <windows.h>
#define SAMP_INFO 0x21A0F8
#define SAMP_POOLS 0x3CD
#define SAMP_FUNC_SAY 0x57F0
bool KeyPressed(BYTE key)
{
return ((GetAsyncKeyState(key)&(1 << 16)) != 0);
}
void Thread()
{
DWORD SampDLL = (DWORD)GetModuleHandleA("samp.dll");
if (SampDLL)
{
DWORD *pInfo = (DWORD*)(SampDLL + SAMP_INFO);
while (*pInfo == 0) Sleep(300);
DWORD *pPools = (DWORD*)(*pInfo + SAMP_POOLS);
DWORD *pPlayerPool = (DWORD*)(*pPools + 24);
DWORD *pLocalPlayer = (DWORD*)(*pPlayerPool + 34);
char msg[128] = "test\0";
bool spam = false;
while (true) {
if (KeyPressed(VK_SPACE)) {
spam = !spam;
Sleep(700);
}
if (spam) {
((void(__thiscall *) (void *_this, char *message)) (SampDLL + SAMP_FUNC_SAY)) (pLocalPlayer, msg);
Sleep(1000);
}
Sleep(10);
}
}
}
int WINAPI DllMain(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
if (reason == DLL_PROCESS_ATTACH)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Thread, 0, 0, 0);
}
return 1;
}