CLEO Help Basic script not working

CLEO related
Status
Not open for further replies.

Husnain

Well-known member
Joined
May 20, 2016
Messages
228
Reaction score
9
Location
Mars
Code:
{$CLEO .cs}
0000:

:SAMP
wait 0
0B34: samp register_client_command "showtext" to_label @text
0B34: samp register_client_command "reload" to_label @reload

:blank
wait 0
jump @blank

:text
wait 0
0B35: samp 1@ = get_last_command_params
if
  0AD4: $NOT_USED = scan_string 1@ format "%s" 3@ //IF and SET
jf @text
0AD1: "Text: %s" 3000 3@
SAMP.CmdRet()

:reload
wait 0
0A94: start_custom_mission "123.cs"
0A93: end_custom_thread
SAMP.CmdRet()

When I try to type any text after [/showtext -text-] and try to show it in 0AD1, it crashes.
 
Last edited:

real_fl1k

Active member
Joined
Apr 23, 2020
Messages
72
Reaction score
8
Location
Belgrade
can't read that sorry try this

Code:
{$CLEO .cs}

0000:

REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

alloc 3@ 128
alloc 1@ 128

0B34: samp register_client_command "showtext" to_label @text
0B34: samp register_client_command "reload" to_label @reload

WHILE TRUE
    WAIT 5000
END

:text
wait 0
0B35: samp 1@ = get_last_command_params
if
0AD4: $NOT_USED = scan_string 1@ format "%s" 3@
then
    0AD1: "Text: %s" 3000 3@
end
SAMP.CmdRet()

:reload
wait 0
0A94: start_custom_mission "123.cs"
0A93: end_custom_thread
SAMP.CmdRet()
 
Last edited:

real_fl1k

Active member
Joined
Apr 23, 2020
Messages
72
Reaction score
8
Location
Belgrade
I added alloc's, try the code again

Code:
{$CLEO .cs}

0000:

REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

alloc 3@ 128
alloc 1@ 128

0B34: samp register_client_command "showtext" to_label @text
0B34: samp register_client_command "reload" to_label @reload

WHILE TRUE
    WAIT 5000
END

:text
wait 0
0B35: samp 1@ = get_last_command_params
if
0AD4: $NOT_USED = scan_string 1@ format "%s" 3@
then
    0AD1: "Text: %s" 3000 3@
end
SAMP.CmdRet()

:reload
wait 0
0A94: start_custom_mission "123.cs"
0A93: end_custom_thread
SAMP.CmdRet()
 
Last edited:

Husnain

Well-known member
Joined
May 20, 2016
Messages
228
Reaction score
9
Location
Mars
NAh, it crashes again.

Whenever I try to enter [/showtext Hello World], It immediately crashes
 

real_fl1k

Active member
Joined
Apr 23, 2020
Messages
72
Reaction score
8
Location
Belgrade
Code:
{$CLEO .cs}

0000:

REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

alloc 1@ 128
alloc 2@ 128

0B34: samp register_client_command "showtext" to_label @text
0B34: samp register_client_command "reload" to_label @reload

WHILE TRUE
    WAIT 5000
END

:text
wait 0
0B35: samp 1@ = get_last_command_params
if
0AD4: $NOT_USED = scan_string 1@ format "%s" 2@
then
    0AD1: "Text: %s" 3000 2@
end
SAMP.CmdRet()

:reload    
wait 0
0A94: start_custom_mission "test1.cs"
0A93: end_custom_thread
SAMP.CmdRet()

hmm this should work but it outputs a wrong string
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
295
Reaction score
100
Location
UGBASE
C++:
:your_label
if
SAMP.IsCommandTyped(0@)
then
    if
    0AD4: $NOT_USED = scan_string 0@ format "%s" $string
    then
        printf "%s" 1337 $string
    end
end
0B43: samp cmd_ret

Try this example.
 

Husnain

Well-known member
Joined
May 20, 2016
Messages
228
Reaction score
9
Location
Mars
C++:
:your_label
if
SAMP.IsCommandTyped(0@)
then
    if
    0AD4: $NOT_USED = scan_string 0@ format "%s" $string
    then
        printf "%s" 1337 $string
    end
end
0B43: samp cmd_ret

Try this example.
Crashing again,
Code:
{$CLEO .cs}
0000:

:SAMP
wait 0
0B34: samp register_client_command "showtext" to_label @text
0B34: samp register_client_command "reload" to_label @reload

:blank
wait 0
jump @blank

:text
if
SAMP.IsCommandTyped(0@)
then
    if
    0AD4: $NOT_USED = scan_string 0@ format "%s" $string
    then
        printf "%s" 1337 $string
    end
end
0B43: samp cmd_ret

:reload
wait 0
0A94: start_custom_mission "check.cs"
0A93: end_custom_thread
SAMP.CmdRet()

Why are we even using 0AD4 like this, you're scanning a string and then formatting into a string again?
Because it is important, later I have to get specific strings so that is why.
 
Status
Not open for further replies.
Top