CLEO Help Read string from X to Y

CLEO related
Status
Not open for further replies.

PopandaulX

Active member
Joined
Jul 15, 2013
Messages
189
Reaction score
1
Hello. I need the opcode to read a string from X to Y. For exemple I have "<name> is calling you. <number>"
I want to read from 26 to 34 I guess...You know, I only want to read <number>. <number> should be like 123-1231, then I need an opcode to add 123 to 1231 and be like 1231231 and then string to integer...omg..
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,502
Solutions
1
Reaction score
247
Location
( ͡° ͜ʖ ͡°)
Thats all you need i think^^

[spoiler:9xy9s0ov]
Code:
//0AB1: call @copy_string 4 text 0@ start 0 end 9 to_buffer 1@
:copy_string
var
    1@: int
    2@: int
    4@: int
    5@: int
end
if 1@ < 0
then
    059A: return_false
    ret 0 
end
0C17: 5@ = strlen 0@
if 2@ > 5@
then
    2@ = 5@
end
if 5@ <= 0
then
    059A: return_false
    ret 0
end
if 2@ < 1@
then
    059A: return_false
    ret 0
end
if 1@ >= 1
then
    for 4@ = 0 to 1@
    inc(0@)
    end
end
2@ -= 1@
inc(2@)
0C10: memcpy destination 3@ source 0@ size 2@
0485: return_true
ret 0

// 0AB1: call @search_text_in_the_text 2 0@ 1@ // 0@ - ?????, 1@ - ?????
:search_text_in_the_text
var 
    2@:int
    3@:int
    4@:int
    5@:int
    7@:int
    8@:int
end
7@ = 0
0C17: 4@ = strlen 0@
0C17: 8@ = strlen 1@
if or 
8@ > 4@
8@ <= 0
then
    059A: return_false
    ret 0
end
0AC8: 6@ = 1024
0C11: memset destination 6@ value 0 size 1024
0C10: memcpy destination 6@ source 1@ size 8@
for 5@ = 0 to 4@
0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
0A8D: 3@ = read_memory 1@ size 1 virtual_protect 0
    if 2@ == 3@
    then 
        inc(1@)
        inc(7@)
    else
        7@ = 0 
        0C10: memcpy destination 1@ source 6@ size 8@    
    end
    if 7@ == 8@
    then
        0485: return_true
        ret 0    
    end
inc(0@) 
end
059A: return_false
0AC9: 6@
ret 0

:getChatEntryText
// 0AB1: call @getChatEntryText 1 id 0@ to 1@
{ In 0@ - ????? ?????? ????. ????? 99.
Out 1@ - ?????????? ? ??????? ???? }
1@ = samp.Base()
1@ += 0x212A24 // SAMP_CHAT_INFO_OFFSET  03x
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ += 0x136
0@ *= 252 // size of stChatEntry
005A: 1@ += 0@ // (int)
1@ += 28
0AB2: ret 1 1@
[/spoiler:9xy9s0ov]
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
275
Thats all you need i think^^

[spoiler:3vmj5y23]
Code:
// 0AB1: call @search_text_in_the_text 2 0@ 1@ // 0@ - ?????, 1@ - ?????
:search_text_in_the_text
var 
    2@:int
    3@:int
    4@:int
    5@:int
    7@:int
    8@:int
end
7@ = 0
0C17: 4@ = strlen 0@
0C17: 8@ = strlen 1@
if or 
8@ > 4@
8@ <= 0
then
    059A: return_false
    ret 0
end
0AC8: 6@ = 1024
0C11: memset destination 6@ value 0 size 1024
0C10: memcpy destination 6@ source 1@ size 8@
for 5@ = 0 to 4@
0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
0A8D: 3@ = read_memory 1@ size 1 virtual_protect 0
    if 2@ == 3@
    then 
        inc(1@)
        inc(7@)
    else
        7@ = 0 
        0C10: memcpy destination 1@ source 6@ size 8@    
    end
    if 7@ == 8@
    then
        0485: return_true
        ret 0    
    end
inc(0@) 
end
059A: return_false
0AC9: 6@
ret 0
[/spoiler:3vmj5y23]

This is useless, there's an opcode for that 0C18.
 

PopandaulX

Active member
Joined
Jul 15, 2013
Messages
189
Reaction score
1
Thats all you need i think^^

[spoiler:f6bpnx6b]
Code:
//0AB1: call @copy_string 4 text 0@ start 0 end 9 to_buffer 1@
:copy_string
var
    1@: int
    2@: int
    4@: int
    5@: int
end
if 1@ < 0
then
    059A: return_false
    ret 0 
end
0C17: 5@ = strlen 0@
if 2@ > 5@
then
    2@ = 5@
end
if 5@ <= 0
then
    059A: return_false
    ret 0
end
if 2@ < 1@
then
    059A: return_false
    ret 0
end
if 1@ >= 1
then
    for 4@ = 0 to 1@
    inc(0@)
    end
end
2@ -= 1@
inc(2@)
0C10: memcpy destination 3@ source 0@ size 2@
0485: return_true
ret 0

// 0AB1: call @search_text_in_the_text 2 0@ 1@ // 0@ - ?????, 1@ - ?????
:search_text_in_the_text
var 
    2@:int
    3@:int
    4@:int
    5@:int
    7@:int
    8@:int
end
7@ = 0
0C17: 4@ = strlen 0@
0C17: 8@ = strlen 1@
if or 
8@ > 4@
8@ <= 0
then
    059A: return_false
    ret 0
end
0AC8: 6@ = 1024
0C11: memset destination 6@ value 0 size 1024
0C10: memcpy destination 6@ source 1@ size 8@
for 5@ = 0 to 4@
0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
0A8D: 3@ = read_memory 1@ size 1 virtual_protect 0
    if 2@ == 3@
    then 
        inc(1@)
        inc(7@)
    else
        7@ = 0 
        0C10: memcpy destination 1@ source 6@ size 8@    
    end
    if 7@ == 8@
    then
        0485: return_true
        ret 0    
    end
inc(0@) 
end
059A: return_false
0AC9: 6@
ret 0

:getChatEntryText
// 0AB1: call @getChatEntryText 1 id 0@ to 1@
{ In 0@ - ????? ?????? ????. ????? 99.
Out 1@ - ?????????? ? ??????? ???? }
1@ = samp.Base()
1@ += 0x212A24 // SAMP_CHAT_INFO_OFFSET  03x
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ += 0x136
0@ *= 252 // size of stChatEntry
005A: 1@ += 0@ // (int)
1@ += 28
0AB2: ret 1 1@
[/spoiler:f6bpnx6b]

Thank you! I'm going to try to understand this in the following 3 weeks and then I'll continue my mods.
 
Status
Not open for further replies.
Top