Help [Delphi] Sending a message to chat

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

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
228
Location
( ͡° ͜ʖ ͡°)
My version would look like this:

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:

U should take a look at BLASTHACK.RU ...
 

m1zg4rd_PL

Well-known member
Joined
Jul 19, 2013
Messages
222
Reaction score
0
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:

Of course, I already have that script, but I'm looking for direct injecting a text to this chat. Any memory writing option?

EDIT: Any idea how to translate this to Pascal?

Code:
#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;
}
 
Top