m1zg4rd_PL
Well-known member
- Joined
- Jul 19, 2013
- Messages
- 222
- Reaction score
- 0
How to send message to SA:MP chat (not to server, only Client-side text!) by Delphi program like 0AF8? I'm using Delphi 7, please help :3
Opcode.eXe link said:Delphi will write the string into a .ini
then my CLEO will get the string from the ini and send it to the chat :dont_care:
#include <windows.h>
void AddChatMessage(DWORD pSAMP, char* text)
{
void* pChatInfo = *((void**)(pSAMP + 0x212A6C));
void(*addMessageFunc)(void*, char*, ...) = (void(*)(void*, char*, ...))(pSAMP + 0x7A980);
addMessageFunc(pChatInfo, text);
}
DWORD WINAPI thread(LPVOID lpThreadParameter)
{
Sleep(3000);
static char txt[128];
DWORD pSAMP = (DWORD)GetModuleHandleA("samp.dll");
for(int i = 0; i < 5; i++)
{
Sleep(1000);
sprintf(txt, "NUM: %d", i);
AddChatMessage(pSAMP, txt);
}
AddChatMessage(pSAMP, "Thread STOP");
return 0;
}
int main(int argc, char** args)
{
DWORD thrdid;
CreateThread(0, 0, thread, (LPVOID)0, 0, &thrdid);
return 0;
}