CLEO Help compare strings

CLEO related
Status
Not open for further replies.

noob213

Active member
Joined
Sep 15, 2017
Messages
88
Reaction score
6
why does not compare the text of the variable $p_name with the file 2@


PHP:
alloc $p_name 50
0AC8: 14@ = allocate_memory_size 256

if                                           
    0A9A: 0@ = openfile "cleo\names.txt" mode "r"
    then
        wait 100
        0AC8: 2@ = allocate_memory_size 4096
        0C11: memset destination 2@ value 0 size 4096
        0AC8: 3@ = allocate_memory_size 96
    repeat
        if 0AD7: read_string_from_file 0@ to 3@ size 95
        then
            0C15: strcat destination 2@ source 3@
            0C11: memset destination 3@ value 0 size 96
        end
    until 0AD6: end_of_file 0@ reached
    0A9B: closefile 0@
    end
    

        while true
            wait 0
            if
            ON == 1
            then
            if
            0C21: stricmp string1 $p_name string2 2@
            then
            chatmsg "compare %s" -1 $p_name
             end
        end
    end       


:check2     
0BE5: raknet 10@ = get_hook_param PARAM_PACKETID
if 10@ == RPC_SCRCLIENTMESSAGE
then
0BE5: raknet 11@ = get_hook_param PARAM_BITSTREAM
0BE7: raknet 12@ = bit_stream_read 11@ type BS_TYPE_INT
0BE7: raknet 13@ = bit_stream_read 11@ type BS_TYPE_INT
0BE8: raknet bit_stream 11@ read_array 14@ size 13@
0C0D: struct 14@ offset 13@ size 1 = 0
if
0C29: 5@ = stristr string1 14@ string2 "the player"                     
then     
0AA5: call 0x8220AD num_params 3 pop 3 params $p_name "the player {00CCFF}%s{FFFFFF}" 5@                                             
IF  0029:   5@ >= 0
then
call @DeleteLastChars 2 $p_name 8               

0BE0: raknet hook_ret false
end
end     
end                   
0BE0: raknet hook_ret true
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,113
Solutions
5
Reaction score
878
Location
Lithuania
PHP:
:ReadTextFromFile
// 0AB1: @ReadTextFromFile0 0@
if 0A9A: 0@ = openfile "CLEO\Names.txt" mode "rt"
then
    0AC8: 1@ = allocate_memory_size 2079
    0C11: memset destination 1@ value 0 size 2079

    0A9C: 2@ = file 0@ size
    2@ += 1
   
    0AC8: 4@ = allocate_memory_size 2@
    0C11: memset destination 4@ value 0 size 2@
    repeat    
        0AD7: read_string_from_file 0@ to 1@ size 2078
        0C17: 3@ = strlen 1@
        if 3@ > 0
        then
            0C15: strcat destination 4@ source 1@
        end
        0C11: memset destination 1@ value 0 size 2079
    until 0AD6: end_of_file 0@ reached  
   
    0AB2: ret 1 4@ 
   
    0AC9: free_allocated_memory 4@
    0AC9: free_allocated_memory 1@
    0A9B: closefile 0@
end            
0AB2: ret 0
 
Status
Not open for further replies.
Top