CLEO Help Can i delete text from chat?

CLEO related
Status
Not open for further replies.

TheDjCody

Active member
Joined
Sep 6, 2018
Messages
40
Reaction score
5
I mean, to a specific text, that when that text is detected, the cleo removes it but without deleting the entire chat, only that line of chat text.

Sorry for my english...
 

real_fl1k

Active member
Joined
Apr 23, 2020
Messages
72
Reaction score
8
Location
Belgrade
0B74: samp set_chat_string 1@ text 2@ prefix 3@ color 4@ prefix_color 5@
+ raknet chat received hook

When a new chat line appears check it, if it's to be removed loop all lines 1 down


for 1@ = 255 to 1 step -1
0006: 6@ = 1@
000E: 6@ -= 1
0B75: samp get_chat_string 6@ text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@
0B74: samp set_chat_string 1@ text 2@ prefix 3@ color 4@ prefix_color 5@
end

replace 255 with count of chat lines
 

TheDjCody

Active member
Joined
Sep 6, 2018
Messages
40
Reaction score
5
0B74: samp set_chat_string 1@ text 2@ prefix 3@ color 4@ prefix_color 5@
+ raknet chat received hook

When a new chat line appears check it, if it's to be removed loop all lines 1 down


for 1@ = 255 to 1 step -1
0006: 6@ = 1@
000E: 6@ -= 1
0B75: samp get_chat_string 6@ text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@
0B74: samp set_chat_string 1@ text 2@ prefix 3@ color 4@ prefix_color 5@
end

replace 255 with count of chat lines

I tried... but not work...

PHP:
{$CLEO .cs}

0000:

REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

WHILE TRUE
   WAIT 0

0006: 6@ = 1@
000E: 6@ -= 1
1@ = 255 to 1 step -1  

IF
0B61:  samp is_local_player_spawned
THEN
    FOR 0@ = 99 TO 99
        0AC8: 1@ = allocate_memory_size 260
        0AC8: 2@ = allocate_memory_size 260
        0B75: samp get_chat_string 0@ text_to 1@ prefix_to 2@ color_to 3@ prefix_color_to 4@
        IF
        0C29: $NOT_USED = stristr string1 1@ string2 "asaltó un negocio"
        THEN
            0B74: samp set_chat_string 1@ text 2@ prefix 3@ color 4@ prefix_color 5@
               
        END
    END
END



END
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
I mean, to a specific text, that when that text is detected, the cleo removes it but without deleting the entire chat, only that line of chat text.

Sorry for my english...
Try intercepting raknet chat packets. Then block them if they are needed to.
 

TheDjCody

Active member
Joined
Sep 6, 2018
Messages
40
Reaction score
5
Try intercepting raknet chat packets. Then block them if they are needed to.

Thanks, i found this by @noob213
:

PHP:
{$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

and this by @monday:

PHP:
{$CLEO}
{$INCLUDE SF}
0000: NOP
while not SAMP.Available()
  wait 400
end
0BE3: raknet setup_incoming_rpc_hook @in_rpc

WHILE TRUE
WAIT 0

wait 1000
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

  // uncomment the following line to see the actual length of the clearing lines (to see if they're empty "" or actually are long messages of empty spaces like "           ")
  // chatmsg "%d" -1 3@

  if 1 >= 3@
  then
  0AC9: free_allocated_memory 4@
  0BE0: raknet hook_ret false
  end

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

and, this is what a tried to make:

PHP:
{$CLEO}
{$INCLUDE SF}
0000: NOP
while not SAMP.Available()
  wait 400
end
0BE3: raknet setup_incoming_rpc_hook @in_rpc

WHILE TRUE
WAIT 0

wait 1000
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 "un negocio en"
  then
  0AC9: free_allocated_memory 4@
  0BE0: raknet hook_ret false
  end

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

And it's working great, thanks you.
 
Last edited:
Status
Not open for further replies.
Top