CLEO Help help with textdraw on/off

CLEO related
Status
Not open for further replies.

davidel

Well-known member
Joined
Jan 17, 2020
Messages
207
Reaction score
7
Location
Germania
Code:
{$CLEO}
{$INCLUDE SF}
0000:
thread "TaxiCMD"

repeat
wait 0
until SAMP.Available()

chatmsg "cv" -1
chatmsg "cv" -1

0B34: samp register_client_command "ress" to_label @command

WHILE TRUE
WAIT 0

2@ = 1298

IF and
1@ == TRUE
0C5D: samp textdraw 2@ is_exists
    then
    chatmsg "txd on" -1
    else
    chatmsg "txd off" -1
    1@ = FALSE
END                     
END

:command
0B12: 1@ = 1@ XOR true
IF 1@ == TRUE
then
chatmsg "started" -1
else
chatmsg "stopped" -1
end
SAMP.CmdRet()
This is what i tried but if textdraw with id 1298 is on screen, chatmsg "txd on" will appear, and if it's not, chatmsg "txd off" will apear
But what i want is an loop or idk, to check the textdraw.. if TEXTDRAW 1298 is on say "txd on" and when will dissapear to say "txd off"

I dont know how to do the red colored part
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,724
Solutions
2
Reaction score
113
It's rather simple instead of -1 you put 0xFF0000 (more colours at colorpicker.net but for basic colours you can just use the 0xRRGGBB format where F = 255 or max and 0 = 0).
Code:
0AF8: samp add_message_to_chat "TEXT" color 0xFFFFFF // White
 

davidel

Well-known member
Joined
Jan 17, 2020
Messages
207
Reaction score
7
Location
Germania
It's rather simple instead of -1 you put 0xFF0000 (more colours at colorpicker.net but for basic colours you can just use the 0xRRGGBB format where F = 255 or max and 0 = 0).
Code:
0AF8: samp add_message_to_chat "TEXT" color 0xFFFFFF // White
no sorry i didnt explain correctly
when i said "I dont know how to do the red colored part " i mean i dont know how to say "asdasd" when the textdraw dissaper

something like

if textdraw exist
then
say "asdasd"
wait until textdraw dissaper
when the textdraw is gone say "aaa"
end the code
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,724
Solutions
2
Reaction score
113
no sorry i didnt explain correctly
when i said "I dont know how to do the red colored part " i mean i dont know how to say "asdasd" when the textdraw dissaper

something like

if textdraw exist
then
say "asdasd"
wait until textdraw dissaper
when the textdraw is gone say "aaa"
end the code
As always lots of ways to do that, I'd go with a loop within a loop though. Also you should check out Sanny Builder Syntax as it's quite fundamental and useful in creating basically any CLEO.
C++:
{$CLEO}
{$INCLUDE SF}

0000:

thread "TaxiCMD"

repeat
    wait 0
until SAMP.Available()

chatmsg "cv" -1
chatmsg "cv" -1

0B34: samp register_client_command "ress" to_label @command

WHILE TRUE
    WAIT 0
    
    //2@ = 1298 No need for a var to hold a non-changing value. P.S. start from 0@
    
    IF and
        0C5D: samp textdraw 1298 is_exists
    then
        chatmsg "txd on" -1
        REPEAT
            WAIT 0
            // waits until the textdraw doesn't exist anymore.
        UNTIL 8C5D: samp textdraw 1298 is_exists // Using 8C5D instead of 0C5D makes the script do something when "samp textdraw is_exists" == false.
        chatmsg "txd off" 0xFF0000
        1@ = FALSE
    END                     
END

:command
0B12: 1@ = 1@ XOR true
IF 1@ == TRUE
then
chatmsg "started" -1
else
chatmsg "stopped" -1
end
SAMP.CmdRet()
 
Status
Not open for further replies.
Top