this code was posted by noob213 in here: http://ugbase.eu/Thread-HELP-Detecting-new-chat-line
I just added the condition to get rid of the line if it's length is equal to or smaller than 1. I also added commented out debug line which you can uncomment if it won't work (in case if the server is actually sending lines full of spaces instead of 0 length messages)
[shcode=cpp]{$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[/shcode]
btw
Code:
if 1 >= 3@
then
//here you could add something like:
// print "The empty chat line was received" 1000
0AC9: free_allocated_memory 4@
0BE0: raknet hook_ret false
end
this way you'll know when admins wanted to clear the chat and what was there