CLEO Help [HELP] Detecting new chat line

CLEO related
Status
Not open for further replies.

DavidRO99

Active member
Joined
Nov 5, 2017
Messages
60
Reaction score
8
So, I had this problem like a month ago or smth, now I managed to find this code, but still cant figure out how to check if it contains "SMS from" so It knows to autoreply
Here is my code:
Code:
{$CLEO .cs}
{$INCLUDE SF}
0000:
repeat
wait 0
until 0AFA:  is_samp_available


0BE3: raknet setup_incoming_rpc_hook @on_new_chatline

:First
wait 0  

if
31@ == 1
then  
31@ = 0
0AF9: samp say_msg "Woah."
end
jump @First

:on_new_chatline
0BE5: raknet 29@ = get_hook_param PARAM_PACKETID
if 29@ == RPC_ScrClientMessage
then
31@ = 1
end
0BE0: raknet hook_ret true
Hope I'm not too noobish...
 

noob213

Active member
Joined
Sep 15, 2017
Messages
88
Reaction score
6
scan a line in the chat?
Code:
{$CLEO}
{$INCLUDE SF}
0000: NOP
while not SAMP.Available()
    wait 400
end
0BE3: raknet setup_incoming_rpc_hook @in_rpc

WHILE TRUE
WAIT 0
END

:in_rpc                   
0BE5: raknet 0@ = get_hook_param PARAM_PACKETID
if 0@ == RPC_SCRCLIENTMESSAGE
then
    0BE5: raknet 1@ = get_hook_param PARAM_BITSTREAM
    0BE7: raknet 2@ = bit_stream_read 1@ type BS_TYPE_INT 
    0BE7: raknet 3@ = bit_stream_read 1@ type BS_TYPE_INT 
    
    0AC8: 4@ = allocate_memory_size 145
    0BE8: raknet bit_stream 1@ read_array 4@ size 3@ 
    0C0D: struct 4@ offset 3@ size 1 = 0 
    if
    0C29: 5@ = stristr string1 4@ string2 "adasd" // compare strings 
    then
        0AF9: samp say_msg "Woah"
    end

    0AC9: free_allocated_memory 4@
end
0BE0: raknet hook_ret true
 

DavidRO99

Active member
Joined
Nov 5, 2017
Messages
60
Reaction score
8
noob213 said:
scan a line in the chat?
Code:
{$CLEO}
{$INCLUDE SF}
0000: NOP
while not SAMP.Available()
    wait 400
end
0BE3: raknet setup_incoming_rpc_hook @in_rpc

WHILE TRUE
WAIT 0
END

:in_rpc                   
0BE5: raknet 0@ = get_hook_param PARAM_PACKETID
if 0@ == RPC_SCRCLIENTMESSAGE
then
    0BE5: raknet 1@ = get_hook_param PARAM_BITSTREAM
    0BE7: raknet 2@ = bit_stream_read 1@ type BS_TYPE_INT 
    0BE7: raknet 3@ = bit_stream_read 1@ type BS_TYPE_INT 
    
    0AC8: 4@ = allocate_memory_size 145
    0BE8: raknet bit_stream 1@ read_array 4@ size 3@ 
    0C0D: struct 4@ offset 3@ size 1 = 0 
    if
    0C29: 5@ = stristr string1 4@ string2 "adasd" // compare strings 
    then
        0AF9: samp say_msg "Woah"
    end

    0AC9: free_allocated_memory 4@
end
0BE0: raknet hook_ret true

Doesnt work
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Example of reading chat:
http://ugbase.eu/Thread-chat-reader-help?pid=108816#pid108816

Example of checking whether text contains some phrase
http://ugbase.eu/Thread-IfTextContains-function

Both tested with Cleo 4.1, Samp 0.3.7 and Sampfuncs 5.3.1
 

DavidRO99

Active member
Joined
Nov 5, 2017
Messages
60
Reaction score
8
noob213 said:
scan a line in the chat?
Code:
{$CLEO}
{$INCLUDE SF}
0000: NOP
while not SAMP.Available()
    wait 400
end
0BE3: raknet setup_incoming_rpc_hook @in_rpc

WHILE TRUE
WAIT 0
END

:in_rpc                   
0BE5: raknet 0@ = get_hook_param PARAM_PACKETID
if 0@ == RPC_SCRCLIENTMESSAGE
then
    0BE5: raknet 1@ = get_hook_param PARAM_BITSTREAM
    0BE7: raknet 2@ = bit_stream_read 1@ type BS_TYPE_INT 
    0BE7: raknet 3@ = bit_stream_read 1@ type BS_TYPE_INT 
    
    0AC8: 4@ = allocate_memory_size 145
    0BE8: raknet bit_stream 1@ read_array 4@ size 3@ 
    0C0D: struct 4@ offset 3@ size 1 = 0 
    if
    0C29: 5@ = stristr string1 4@ string2 "adasd" // compare strings 
    then
        0AF9: samp say_msg "Woah"
    end

    0AC9: free_allocated_memory 4@
end
0BE0: raknet hook_ret true
It ended up actually working... Thanks! Liked!
 
Status
Not open for further replies.
Top