[SA] Memory address of the last chat message?

proteh

Member
Joined
Jun 18, 2013
Messages
21
Reaction score
0
Hello. I can't get the offset from the samp chatinfo address containing the last chat message. Does anyone know what the offset is? I need to retrieve the last chat message and if possible any chat entry from the chat box.
 

MyU

Member
Joined
Apr 23, 2015
Messages
8
Reaction score
0
https://github.com/BlastHackNet/mod_s0beit_sa/blob/master/src/samp.h#L612
https://github.com/BlastHackNet/mod_s0beit_sa/blob/master/src/samp.h#L600
https://github.com/BlastHackNet/mod_s0beit_sa/blob/master/src/samp.cpp#L495

these could help you reconstructing everything you need, or take the same code from mod_sa.
Addresses are also in samp.h.

I could explain it in more depth but I think it's everything you need right now.
 

HooThaFuck

Active member
Joined
Apr 18, 2015
Messages
51
Reaction score
0
This is what Opcode gave me to memory hack it.

Code:
:getChatEntryText
0AF7: samp 1@ = get_base
1@ += 0x212A6C
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ += 0x136
0@ *= 252 // size of stChatEntry
005A: 1@ += 0@ // (int)
1@ += 28
0AB2: ret 1 1@

So the offset is 0x212A6C right?
 

0B36

Expert
Joined
Jan 6, 2014
Messages
1,324
Reaction score
8
HooThaFuck link said:
This is what Opcode gave me to memory hack it.

Code:
:getChatEntryText
0AF7: samp 1@ = get_base
1@ += 0x212A6C
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ += 0x136
0@ *= 252 // size of stChatEntry
005A: 1@ += 0@ // (int)
1@ += 28
0AB2: ret 1 1@

So the offset is 0x212A6C right?

That's the snippet for CLEO only.
 

proteh

Member
Joined
Jun 18, 2013
Messages
21
Reaction score
0
Got it. Thanks guys, it works.

Here's the code:

Code:
int obtenerMensajeChat(HANDLE *procesoGTA, DWORD *direccionBase, int entrada, char *destino) {

    if(*procesoGTA == NULL || *direccionBase == DIR_NULA || direccionBase == NULL)
        return 0;

	DWORD dir;
    int resultado = ReadProcessMemory(*procesoGTA, (LPVOID)(*direccionBase + DIR_INFO_SAMP_CHAT), &dir, sizeof(dir), NULL);

	if (!resultado)
		return 0;

	// Escalamos hasta la dirección del mensaje...
	dir += 0x136;
	entrada *= 252;
	dir += entrada;
	dir += 28;
	// Lo leemos
	ReadProcessMemory(*procesoGTA, (LPVOID)dir, destino, MAX_CAR_MENSAJE_CHAT_SAMP, NULL);
    return 1;
}
 

0B36

Expert
Joined
Jan 6, 2014
Messages
1,324
Reaction score
8
HooThaFuck link said:
That's not the point, the snippet contained the addresses he needed.

and, that's also not needed because s0beit's samp.h has them all listed and defined, which MyU already linked before you posted.
 

MyU

Member
Joined
Apr 23, 2015
Messages
8
Reaction score
0
0B36 link said:
and, that's also not needed because s0beit's samp.h has them all listed and defined, which MyU already linked before you posted.
atleast it saved him the hassle to get offsets by the structures (since he actually was in need todo the math based on size of the type :))
 

HooThaFuck

Active member
Joined
Apr 18, 2015
Messages
51
Reaction score
0
MyU link said:
atleast it saved him the hassle to get offsets by the structures (since he actually was in need todo the math based on size of the type :))
This and the fact that his code is literally the same as the cleo code but converted. XD
 
Top