Reading chatlog

encrypted566

Active member
Joined
Jan 15, 2014
Messages
26
Reaction score
0
Alright, I'm wondering if there is a cleo script or autohotkey code that reads for example my chatlog while I'm in-game.

For example, someone sends me a PM and if string in the chatlog contains "PM from", I write the code that returns an automated reply in-game.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
hi, you could use cleo like this:

Code:
{$CLEO .cs}
{$INCLUDE SF}
0000:
repeat
wait 0
until 0AFA:  is_samp_available
0B34: samp register_client_command "activate" to_label @activate
 
 
0BE3: raknet setup_incoming_rpc_hook @on_new_chatline
 
:First
wait 0  
 
if and
31@ == 1
30@ == 1
then
31@ = 0
0AC8: 0@ = allocate_memory_size 260
0AB1: @GETCHATENTRYTEXT 1 id 99 to 0@  
    if
    0AD4: 2@ = scan_string 0@ format "PM from: %d" 1@
    then
    0AF9: samp say_msg "I just received a message, allelujah" 
    end
0AC9: free_allocated_memory 0@   
end
jump @First
 
:activate
0B12: 30@ = 30@ XOR 1
samp.CmdRet
 
:on_new_chatline
0BE5: raknet 29@ = get_hook_param PARAM_PACKETID
if 29@ == RPC_ScrClientMessage
then
31@ = 1
end
0BE0: raknet hook_ret true
 
 
: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: 1 1@

I didn't test it though... and I'm not sure about this line:
[font=Monaco, Consolas, Courier, monospace]0AD4: 2@ = scan_string 0@ format "PM from: %d" 1@[/font]
[font=Monaco, Consolas, Courier, monospace]Idk if it needs to be the exact full text but I'd also try adding "%s" at the end like:[/font]
[font=Monaco, Consolas, Courier, monospace][size=small][font=Monaco, Consolas, Courier, monospace]0AD4: 2@ = scan_string 0@ format "PM from: %d%s" 1@[/font][/font][/size]

[font=Monaco, Consolas, Courier, monospace][size=small][font=Monaco, Consolas, Courier, monospace]Or somehow cut off the string and then compare it[/font][/font][/size]
 

encrypted566

Active member
Joined
Jan 15, 2014
Messages
26
Reaction score
0
Thank you for your help guys, I'll look into it. I have some basic programming knowledge so I'll try to figure it out.
 
Top