CLEO Help String help

CLEO related
Status
Not open for further replies.

razvangsb

New member
Joined
Apr 11, 2016
Messages
3
Reaction score
0
I want to extract just part of a string. The name in this case http://imgur.com/a/TgzoT (The one below is the texdraw I'm getting the string from) above is [font=Monaco, Consolas, Courier, monospace]0AD1[/font]
Is there any opcode like C++'s str.substr ? As I already have  the begining (1@) and at the end (2@), it would be easy if something similar existed
I tried messing around with 0AD3 and 0AD4, but wasn't successful. I don't understand how they work


what I have at the moment

Code:
alloc 0@ = 1024
    0C5A: samp textdraw 2053 get_string_to 0@
    IF 0C18: 1@ = strstr string1 0@ string2 "to "
    THEN
        1@ += 2
        0C18: 2@ = strstr string1 0@ string2 ":"
        
        0AD1: "%s" 1000 1@
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
0C19: 1@ = strcspn string1 0@ string2 ":"
1@ -= 1
0C24: strncpy destination 0@ source0@ size 1@

The only way I know
What it does here, it finds the entry of ":", then gives its position in string, after it just substracts 1 from it, and copies with given size
 

razvangsb

New member
Joined
Apr 11, 2016
Messages
3
Reaction score
0
It somehow worked, thank you.
But I got some weird results.

At first, with the textdraw it kept crashing. I tried with a string from the the chat and it worked but it changed the line in chat too http://imgur.com/pix0XxS . (Maybe this may be usefull for something else)
I tried changing the destination on 0C24 so it won't be same as the source and it made the string (Null) http://imgur.com/a/meZLg
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
razvangsb said:
It somehow worked, thank you.
But I got some weird results.

At first, with the textdraw it kept crashing. I tried with a string from the the chat and it worked but it changed the line in chat too http://imgur.com/pix0XxS . (Maybe this may be usefull for something else)
I tried changing  the destination on 0C24 so it won't be same as the source and it made the string (Null)  http://imgur.com/a/meZLg

1. Can't really understand this one
2. You changed destination? To another variable and it's null? Then maybe you didn't allocate memory for it

I dunno how these 3 lines of code couldn't work, maybe you didn't use them properly?
 

razvangsb

New member
Joined
Apr 11, 2016
Messages
3
Reaction score
0
supahdupahnubah said:
1. Can't really understand this one
2. You changed destination? To another variable and it's null? Then maybe you didn't allocate memory for it

1.It changed the text sent by the server "That marker set on...." is not sent by the cleo i posted images. But NVM, that is not important
2. You right. I didn't know I had to allocate memory. Thank you
 

Rough

Active member
Joined
Mar 7, 2015
Messages
42
Reaction score
4
I think I know what you want to do, be carefull because I think it's ilegall.. meh..

about getting string, I used to scan string with 0C18: 2@ = strstr string1 0@ string2 1@ springfield once said you can scan a string in string with it...


god luck tho
 
Status
Not open for further replies.
Top