Help Anyone know how to fix this? (See the picture).

Doublesix

Active Member
Joined
Nov 14, 2018
Messages
44
Likes
0
Points
6
5
#1
How can i fix this? i can't scan text 2 (Strip) its must be "The Strip". But as you can see, it just says "The". How to scan full chat string at 1 lines?

This is the code i use:
Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
thread "EasyTaxi"
0000: NOP

:EasyTaxi_14
wait 0
   SAMP.Available
else_jump @EasyTaxi_14

:EasyTaxi_86
wait 0
if and
   SAMP.IsLocalPlayerSpawned
   not SAMP.IsDialogActive(-1)
else_jump @EasyTaxi_86
alloc [email protected] 160
SAMP.GetChatString(98, [email protected], $NOT_USED, $NOT_USED, $NOT_USED)
if
0AD4: $NOT_USED = scan_string [email protected] format "Destination: {33AA33}%s" [email protected] 
else_jump @EasyTaxi_86
wait 1000
say "/do Terlihat seseorang telah memasuki Taxi milik Ace."
wait 1000
say "Tujuan kemana?"
wait 2000
say "/do Penumpang: %s" [email protected]
wait 1000
say "Oke, berangkat kita."
wait 200
free [email protected]
jump @EasyTaxi_86
Translate to English:
** You can see someone has entering the Ace's Taxi.
(Japanese) Ace Kiramatsu says: Where we go?
** Passenger: The (( Ace Kiramatsu ))
(Japanese) Ace Kiramatsu says: Oke, lets go.
 

Attachments

Opcode.eXe

Well-Known Member
Joined
Feb 18, 2013
Messages
1,393
Likes
108
Points
113
Location
( ͡° ͜ʖ ͡°)
Website
www.youtube.com
#2
Im not sure if it works, but thats how i would do it:
- You maybe have to change the color of Destination: {00FF00}

Code:
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY


WHILE TRUE
    WAIT 0
    IF
    0B61:  samp is_local_player_spawned
    THEN
        IF
        8B4C: not samp is_dialog_active -1
        THEN
            0AC8: [email protected] = allocate_memory_size 260
            0AC8: [email protected] = allocate_memory_size 260
            0B75: samp get_chat_string 99 text_to [email protected] prefix_to [email protected] color_to [email protected] prefix_color_to [email protected]
            
            IF
            0AD4: [email protected] = scan_string [email protected] format "Destination: {00FF00}" // 21 chars in this string
            THEN
                0C17: [email protected] = strlen [email protected]
                [email protected] -= 21 // remove 21 chars
                0AB1: @COPY_STRING 4 text [email protected] start 21 end [email protected] to_buffer [email protected]
                wait 1000
                say "/do Terlihat seseorang telah memasuki Taxi milik Ace."
                wait 1000
                say "Tujuan kemana?"
                wait 2000
                say "/do Penumpang: %s" [email protected]
                wait 1000
                say "Oke, berangkat kita."
                wait 200
    
            END
            
            
            0AC9: free_allocated_memory [email protected]
            0AC9: free_allocated_memory [email protected]
        END
    END
END




:copy_string
var
    [email protected]: int
    [email protected]: int
    [email protected]: int
    [email protected]: int
end
if [email protected] < 0
then
    059A: return_false
    ret 0
end
0C17: [email protected] = strlen [email protected]
if [email protected] > [email protected]
then
    [email protected] = [email protected]
end
if [email protected] <= 0
then
    059A: return_false
    ret 0
end
if [email protected] < [email protected]
then
    059A: return_false
    ret 0
end
if [email protected] >= 1
then
    for [email protected] = 0 to [email protected]
    inc([email protected])
    end
end
[email protected] -= [email protected]
inc([email protected])
0C10: memcpy destination [email protected] source [email protected] size [email protected]
0485: return_true
ret 0
 
OP
OP
Doublesix

Doublesix

Active Member
Joined
Nov 14, 2018
Messages
44
Likes
0
Points
6
5
#3
Im not sure if it works, but thats how i would do it:
- You maybe have to change the color of Destination: {00FF00}

Code:
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY


WHILE TRUE
    WAIT 0
    IF
    0B61:  samp is_local_player_spawned
    THEN
        IF
        8B4C: not samp is_dialog_active -1
        THEN
            0AC8: [email protected] = allocate_memory_size 260
            0AC8: [email protected] = allocate_memory_size 260
            0B75: samp get_chat_string 99 text_to [email protected] prefix_to [email protected] color_to [email protected] prefix_color_to [email protected]
           
            IF
            0AD4: [email protected] = scan_string [email protected] format "Destination: {00FF00}" // 21 chars in this string
            THEN
                0C17: [email protected] = strlen [email protected]
                [email protected] -= 21 // remove 21 chars
                0AB1: @COPY_STRING 4 text [email protected] start 21 end [email protected] to_buffer [email protected]
                wait 1000
                say "/do Terlihat seseorang telah memasuki Taxi milik Ace."
                wait 1000
                say "Tujuan kemana?"
                wait 2000
                say "/do Penumpang: %s" [email protected]
                wait 1000
                say "Oke, berangkat kita."
                wait 200
   
            END
           
           
            0AC9: free_allocated_memory [email protected]
            0AC9: free_allocated_memory [email protected]
        END
    END
END




:copy_string
var
    [email protected]: int
    [email protected]: int
    [email protected]: int
    [email protected]: int
end
if [email protected] < 0
then
    059A: return_false
    ret 0
end
0C17: [email protected] = strlen [email protected]
if [email protected] > [email protected]
then
    [email protected] = [email protected]
end
if [email protected] <= 0
then
    059A: return_false
    ret 0
end
if [email protected] < [email protected]
then
    059A: return_false
    ret 0
end
if [email protected] >= 1
then
    for [email protected] = 0 to [email protected]
    inc([email protected])
    end
end
[email protected] -= [email protected]
inc([email protected])
0C10: memcpy destination [email protected] source [email protected] size [email protected]
0485: return_true
ret 0
Still not work bro. Nothing happen when i try at the Game.
 

monday

Well-Known Member
Joined
Jun 23, 2014
Messages
946
Likes
14
Points
68
#5
maybe try using format like this: "Destination: {%*[^}]}%[^\n]"

It works well with sscanf here: https://www.onlinegdb.com/online_c_compiler
C:
#include <stdio.h>

int main()
{
    char *chatline = "Destination: {33AA33}The Strip";
    
    char parsed[100] = {0};
    sscanf(chatline, "Destination: {%*[^}]}%[^\n]", parsed);
    printf(parsed);
    return 0;
}
This should work with any color, just try that with your original code
 

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
775
Likes
26
Points
43
Location
Lithuania
Website
ugbase.eu
10
#6
maybe try using format like this: "Destination: {%*[^}]}%[^\n]"

It works well with sscanf here: https://www.onlinegdb.com/online_c_compiler
C:
#include <stdio.h>

int main()
{
    char *chatline = "Destination: {33AA33}The Strip";
 
    char parsed[100] = {0};
    sscanf(chatline, "Destination: {%*[^}]}%[^\n]", parsed);
    printf(parsed);
    return 0;
}
This should work with any color, just try that with your original code
Wow you again made awesome format , very useful, thanks

If i not doing wrong
PHP:
{$CLEO .cs}

0000: NOP

repeat
wait 0
until 0AFA: SAMP_IS_READY

while true
wait 0

if
0B61:  samp is_local_player_spawned
then
    0AC8: [email protected] = allocate_memory_size 260
    0AC8: [email protected] = allocate_memory_size 260
    0B75: samp get_chat_string 99 text_to [email protected] prefix_to [email protected] color_to [email protected] prefix_color_to [email protected]
    if
    0AD4: $NOT_USED = scan_string [email protected] format "Destination: {%*[^}]}%[^\n]" $NOT_USED [email protected] //IF and SET
    then
        0AD1: show_formatted_text_highpriority "%s" time 1337 [email protected]
    end
end

end
 
Last edited:

monday

Well-Known Member
Joined
Jun 23, 2014
Messages
946
Likes
14
Points
68
#7
the function of * character in the format is to ignore that expression, meaning that you extract only one expression instead of 2, so only 1 output parameter is required (so $NOT_USED could be deleted)

Code:
if 0AD4: $NOT_USED = scan_string [email protected] format "Destination: {%*[^}]}%[^\n]" [email protected]
Or:
Code:
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0 // just to make sure that it's empty
0AA5: call 0x8220AD num_params 3 pop 3 [email protected] "Destination: {%*[^}]}%[^\n]" [email protected]
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // read first byte to check if it was overwritten
if [email protected] > 0
then
// the format was found
end
If you remove the * character then you can also supply another parameter to get the color of the text to reuse it later (as a string, unless you convert it or change the expression into %x). Here's example:
Code:
#include <stdio.h>

int main()
{
    char *chatline = "Destination: {33AA33}The Strip";
    
    char parsed_text[100] = {0};
    char parsed_color_str[100] = {0};
    int parsed_color_int;
    sscanf(chatline, "Destination: {%[^}]}%[^\n]", parsed_color_str, parsed_text);
    
    sscanf(chatline, "Destination: {%x}%[^\n]", &parsed_color_int, parsed_text);
    
    printf("Parsed text = %s\nParsed color (string) = %s\nParsed color (int, hex) = %X", parsed_text, parsed_color_str, parsed_color_int);
    
    return 0;
}
It prints out:
Parsed text = The Strip
Parsed color (string) = 33AA33
Parsed color (int, hex) = 33AA33
Btw keep in mind to use `alloc [email protected] 200` at the begining of the code
 
Last edited:
OP
OP
Doublesix

Doublesix

Active Member
Joined
Nov 14, 2018
Messages
44
Likes
0
Points
6
5
#8
Like this?
Code:
:EasyTaxi_27
wait 0
if and
   SAMP.IsLocalPlayerSpawned
   not SAMP.IsDialogActive(-1)
else_jump @EasyTaxi_27
alloc [email protected] 160
alloc [email protected] 200
SAMP.GetChatString(98, [email protected], $NOT_USED, $NOT_USED, $NOT_USED)
if
0AD4: $NOT_USED = scan_string [email protected] format "Destination: {%[^}]}%[^\n]" [email protected]
else_jump @EasyTaxi_27
wait 1000
say "Destination Detected: %s" [email protected]
wait 200
free [email protected]
free [email protected]
jump @EasyTaxi_27
 

monday

Well-Known Member
Joined
Jun 23, 2014
Messages
946
Likes
14
Points
68
#9
the "*" is not there which means that the color will also be extracted and overwrite [email protected], the desired text will try to overwrite the next address on the stack (which should be provided and wasn't)

so either use:
0AD4: $NOT_USED = scan_string [email protected] format "Destination: {%*[^}]}%[^\n]" [email protected]

or:
-add alloc [email protected]
-add free [email protected]
-use: 0AD4: $NOT_USED = scan_string [email protected] format "Destination: {%[^}]}%[^\n]" [email protected] [email protected]
//[email protected] will contain the color, [email protected] will contain the text

If you pick one of these methods and it still won't work then try using the following:
Code:
:EasyTaxi_27
wait 0
if and
   SAMP.IsLocalPlayerSpawned
   not SAMP.IsDialogActive(-1)
else_jump @EasyTaxi_27
alloc [email protected] 160
alloc [email protected] 200
SAMP.GetChatString(98, [email protected], $NOT_USED, $NOT_USED, $NOT_USED)
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0 // just to make sure that it's empty
0AA5: call 0x8220AD num_params 3 pop 3 [email protected] "Destination: {%*[^}]}%[^\n]" [email protected]
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // read first byte to check if it was overwritten
if [email protected] > 0
else_jump @EasyTaxi_27
wait 1000
say "Destination Detected: %s" [email protected]
wait 200
free [email protected]
free [email protected]
jump @EasyTaxi_27
just make sure that [email protected] does not interfere with other parts of the code (if it's used in other places)

Btw why are you using "98" instead of "99" in SAMP.GetChatString?
 
OP
OP
Doublesix

Doublesix

Active Member
Joined
Nov 14, 2018
Messages
44
Likes
0
Points
6
5
#10
the "*" is not there which means that the color will also be extracted and overwrite [email protected], the desired text will try to overwrite the next address on the stack (which should be provided and wasn't)

so either use:
0AD4: $NOT_USED = scan_string [email protected] format "Destination: {%*[^}]}%[^\n]" [email protected]

or:
-add alloc [email protected]
-add free [email protected]
-use: 0AD4: $NOT_USED = scan_string [email protected] format "Destination: {%[^}]}%[^\n]" [email protected] [email protected]
//[email protected] will contain the color, [email protected] will contain the text

If you pick one of these methods and it still won't work then try using the following:
Code:
:EasyTaxi_27
wait 0
if and
   SAMP.IsLocalPlayerSpawned
   not SAMP.IsDialogActive(-1)
else_jump @EasyTaxi_27
alloc [email protected] 160
alloc [email protected] 200
SAMP.GetChatString(98, [email protected], $NOT_USED, $NOT_USED, $NOT_USED)
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0 // just to make sure that it's empty
0AA5: call 0x8220AD num_params 3 pop 3 [email protected] "Destination: {%*[^}]}%[^\n]" [email protected]
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // read first byte to check if it was overwritten
if [email protected] > 0
else_jump @EasyTaxi_27
wait 1000
say "Destination Detected: %s" [email protected]
wait 200
free [email protected]
free [email protected]
jump @EasyTaxi_27
just make sure that [email protected] does not interfere with other parts of the code (if it's used in other places)

Btw why are you using "98" instead of "99" in SAMP.GetChatString?
Why me using "98" instead of "99" in SAMP.GetChatString? Because when I type /starttaxi at the server, it will be like this.So i use 98.
 

Attachments

OP
OP
Doublesix

Doublesix

Active Member
Joined
Nov 14, 2018
Messages
44
Likes
0
Points
6
5
#11
the "*" is not there which means that the color will also be extracted and overwrite [email protected], the desired text will try to overwrite the next address on the stack (which should be provided and wasn't)

so either use:
0AD4: $NOT_USED = scan_string [email protected] format "Destination: {%*[^}]}%[^\n]" [email protected]

or:
-add alloc [email protected]
-add free [email protected]
-use: 0AD4: $NOT_USED = scan_string [email protected] format "Destination: {%[^}]}%[^\n]" [email protected] [email protected]
//[email protected] will contain the color, [email protected] will contain the text

If you pick one of these methods and it still won't work then try using the following:
Code:
:EasyTaxi_27
wait 0
if and
   SAMP.IsLocalPlayerSpawned
   not SAMP.IsDialogActive(-1)
else_jump @EasyTaxi_27
alloc [email protected] 160
alloc [email protected] 200
SAMP.GetChatString(98, [email protected], $NOT_USED, $NOT_USED, $NOT_USED)
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0 // just to make sure that it's empty
0AA5: call 0x8220AD num_params 3 pop 3 [email protected] "Destination: {%*[^}]}%[^\n]" [email protected]
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // read first byte to check if it was overwritten
if [email protected] > 0
else_jump @EasyTaxi_27
wait 1000
say "Destination Detected: %s" [email protected]
wait 200
free [email protected]
free [email protected]
jump @EasyTaxi_27
just make sure that [email protected] does not interfere with other parts of the code (if it's used in other places)

Btw why are you using "98" instead of "99" in SAMP.GetChatString?
Can i add something like "." or "Sir" at /say "Destination Detected: %s"/?

Example:
say "I want to go %s, sir." [email protected]
 
OP
OP
Doublesix

Doublesix

Active Member
Joined
Nov 14, 2018
Messages
44
Likes
0
Points
6
5
#12
It work, but not fully working. Idk why, you can see the picture.

This is the code:

Code:
:EasyTaxi_27
wait 0
if and
   SAMP.IsLocalPlayerSpawned
   not SAMP.IsDialogActive(-1)
else_jump @EasyTaxi_27
alloc [email protected] 160
alloc [email protected] 200
SAMP.GetChatString(98, [email protected], $NOT_USED, $NOT_USED, $NOT_USED)
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0 // just to make sure that it's empty
0AA5: call 0x8220AD num_params 3 pop 3 [email protected] "Destination: {%*[^}]}%[^\n]" [email protected]
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // read first byte to check if it was overwritten
if [email protected] > 0
else_jump @EasyTaxi_27
wait 1000   
say "/do Terlihat seseorang telah memasuki Taxi milik Ace."
wait 1100
say "Tujuan kemana?"
wait 1100
say "/do Penumpang: Ke %s" [email protected]
wait 200
free [email protected]
free [email protected]
jump @EasyTaxi_27
 

Attachments

monday

Well-Known Member
Joined
Jun 23, 2014
Messages
946
Likes
14
Points
68
#13
It looks like the problem is that it stops on "\" and "n" instead of stopping on newline byte, I'll check it out with different function and I'll let you know
 

monday

Well-Known Member
Joined
Jun 23, 2014
Messages
946
Likes
14
Points
68
#14
this one should work
Code:
:EasyTaxi_27
wait 0
if and
   SAMP.IsLocalPlayerSpawned
   not SAMP.IsDialogActive(-1)
else_jump @EasyTaxi_27
alloc [email protected] 160
alloc [email protected] 200
SAMP.GetChatString(98, [email protected], $NOT_USED, $NOT_USED, $NOT_USED)
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0 // just to make sure that it's empty
0AC6: [email protected] = label @format offset
0AA5: call 0x8220AD num_params 3 pop 3 [email protected] [email protected] [email protected]
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // read first byte to check if it was overwritten
if [email protected] > 0
else_jump @EasyTaxi_27
wait 1000   
say "/do Terlihat seseorang telah memasuki Taxi milik Ace."
wait 1100
say "Tujuan kemana?"
wait 1100
say "/do Penumpang: Ke %s" [email protected]
wait 200
free [email protected]
free [email protected]
jump @EasyTaxi_27

:format
hex
"Destination: {%*[^}]}%[^" 0A "]" 00
end
 
OP
OP
Doublesix

Doublesix

Active Member
Joined
Nov 14, 2018
Messages
44
Likes
0
Points
6
5
#15
this one should work
Code:
:EasyTaxi_27
wait 0
if and
   SAMP.IsLocalPlayerSpawned
   not SAMP.IsDialogActive(-1)
else_jump @EasyTaxi_27
alloc [email protected] 160
alloc [email protected] 200
SAMP.GetChatString(98, [email protected], $NOT_USED, $NOT_USED, $NOT_USED)
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0 // just to make sure that it's empty
0AC6: [email protected] = label @format offset
0AA5: call 0x8220AD num_params 3 pop 3 [email protected] [email protected] [email protected]
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // read first byte to check if it was overwritten
if [email protected] > 0
else_jump @EasyTaxi_27
wait 1000  
say "/do Terlihat seseorang telah memasuki Taxi milik Ace."
wait 1100
say "Tujuan kemana?"
wait 1100
say "/do Penumpang: Ke %s" [email protected]
wait 200
free [email protected]
free [email protected]
jump @EasyTaxi_27

:format
hex
"Destination: {%*[^}]}%[^" 0A "]" 00
end
Thanks man, it work.
 
Top