CLEO Help Draw_Outlined_Box

CLEO related
Status
Not open for further replies.

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
300
Reaction score
36
Location
Srbija
How to make some commands and with them to change color of box?

Code:
0AB1: call_scm_func @DRAW_OUTLINED_BOX 9 POS 7@ 8@ SIZE 50.0 50.0 RGBA 255 255 51 0.2 THICKNESS 2.5
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
Make a command that takes RGBA input and store them to vars and simply the RGBA values in the opcode with those vars.
 

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
300
Reaction score
36
Location
Srbija
Why is this not good?

Code:
0AB1: call_scm_func @DRAW_OUTLINED_BOX 9 POS 7@ 8@ SIZE 50.0 50.0 RGBA 4@ 5@ 6@ 7@ THICKNESS 2.5

Code:
:kitica
4@ = 255
5@ = 255
6@ = 51
7@ = 0.2
samp.CmdRet

Code:
:kurcina
4@ = 153
5@ = 51
6@ = 51
7@ = 0.2
samp.CmdRe
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
Why is this not good?

Code:
0AB1: call_scm_func @DRAW_OUTLINED_BOX 9 POS 7@ 8@ SIZE 50.0 50.0 RGBA 4@ 5@ 6@ 7@ THICKNESS 2.5

Code:
:kitica
4@ = 255
5@ = 255
6@ = 51
7@ = 0.2
samp.CmdRet

Code:
:kurcina
4@ = 153
5@ = 51
6@ = 51
7@ = 0.2
samp.CmdRe
It's 7@ RGBA = all integer values so it can't be 0.2 it must be 0-255 you can always use some math if u want to use floats to determine the ALPHA.
 

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
300
Reaction score
36
Location
Srbija
So i did it like this

Code:
:cszuta
4@ = 255
5@ = 51
6@ = 51
7@ = 255
samp.CmdRet

And it should be red, but its greene and when I move it starts blinking
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
So i did it like this

Code:
:cszuta
4@ = 255
5@ = 51
6@ = 51
7@ = 255
samp.CmdRet

And it should be red, but its greene and when I move it starts blinking
Gonna have to show more of the code then or maybe the :DRAWBOX snippet.
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
Well i have that snippet lol, but how can i change colors by comand?
What I said before, but you said it doesn't work so it's obvious you didn't implement into your script correctly I just want to see the rest of the "drawbox" code as there are different ways of drawing boxes in cleo. But most likely it will be to do with the rest of the script. Just make sure 4@ 5@ 6@ 7@ are not being changed so anywhere in the script where those vars are being changed (outside of the cmd) are causing problems.
 

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
300
Reaction score
36
Location
Srbija
So i did as you sad

Code:
0AB1: call_scm_func @DRAW_OUTLINED_BOX 9 POS 7@ 8@ SIZE 50.0 50.0 RGBA 4@ 5@ 6@ 7@ THICKNESS 2.5

Code:
:godfelazpickica
4@ = 255
5@ = 51
6@ = 51
7@ = 255
samp.CmdRet

Code:
:DRAW_OUTLINED_BOX                                                                                           
0087: 14@  = 8@                                                                                                   // (float)
0087: 12@ = 2@                                                                                                    // (float)
0087: 13@ = 3@                                                                                                    // (float)
12@ /= 2.0                                                                                                        // (float)
13@ /= 2.0                                                                                                        // (float)
0087: 8@  = 0@                                                                                                    // (float)
005B: 8@ += 2@                                                                                                    // (float)
0063: 8@ -= 12@                                                                                                   // (float)
0087: 9@  = 0@                                                                                                    // (float)
0063: 9@ -= 2@                                                                                                    // (float)
005B: 9@ += 12@                                                                                                   // (float)
0087: 10@ = 1@                                                                                                    // (float)
005B: 10@ += 3@                                                                                                   // (float)
0063: 10@ -= 13@                                                                                                  // (float)
0087: 11@ = 1@                                                                                                    // (float)     by Opkodex
0063: 11@ -= 3@                                                                                                   // (float)
005B: 11@ += 13@                                                                                                  // (float)   
03F0: enable_text_draw 1                                                                                          //UPALJEN TEXTDRAW
038E: draw_box_position  8@ 1@  size 14@ 3@ RGBA  4@ 5@ 6@ 7@                                                      //  links
038E: draw_box_position  9@ 1@  size 14@ 3@ RGBA  4@ 5@ 6@ 7@                                                      // rechts
038E: draw_box_position  0@ 10@  size 2@ 14@ RGBA 4@ 5@ 6@ 7@                                                     // oben
038E: draw_box_position  0@ 11@  size 2@ 14@ RGBA 4@ 5@ 6@ 7@

And what the fuck is problem???
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
So i did as you sad

Code:
0AB1: call_scm_func @DRAW_OUTLINED_BOX 9 POS 7@ 8@ SIZE 50.0 50.0 RGBA 4@ 5@ 6@ 7@ THICKNESS 2.5

Code:
:godfelazpickica
4@ = 255
5@ = 51
6@ = 51
7@ = 255
samp.CmdRet

Code:
:DRAW_OUTLINED_BOX                                                                                          
0087: 14@  = 8@                                                                                                   // (float)
0087: 12@ = 2@                                                                                                    // (float)
0087: 13@ = 3@                                                                                                    // (float)
12@ /= 2.0                                                                                                        // (float)
13@ /= 2.0                                                                                                        // (float)
0087: 8@  = 0@                                                                                                    // (float)
005B: 8@ += 2@                                                                                                    // (float)
0063: 8@ -= 12@                                                                                                   // (float)
0087: 9@  = 0@                                                                                                    // (float)
0063: 9@ -= 2@                                                                                                    // (float)
005B: 9@ += 12@                                                                                                   // (float)
0087: 10@ = 1@                                                                                                    // (float)
005B: 10@ += 3@                                                                                                   // (float)
0063: 10@ -= 13@                                                                                                  // (float)
0087: 11@ = 1@                                                                                                    // (float)     by Opkodex
0063: 11@ -= 3@                                                                                                   // (float)
005B: 11@ += 13@                                                                                                  // (float)  
03F0: enable_text_draw 1                                                                                          //UPALJEN TEXTDRAW
038E: draw_box_position  8@ 1@  size 14@ 3@ RGBA  4@ 5@ 6@ 7@                                                      //  links
038E: draw_box_position  9@ 1@  size 14@ 3@ RGBA  4@ 5@ 6@ 7@                                                      // rechts
038E: draw_box_position  0@ 10@  size 2@ 14@ RGBA 4@ 5@ 6@ 7@                                                     // oben
038E: draw_box_position  0@ 11@  size 2@ 14@ RGBA 4@ 5@ 6@ 7@

And what the fuck is problem???
Ok so nothing is up with the snippet it's the rest of the code then. Something must be changing the vars you need to use vars that are not being used literally anywhere else. Seen as you're so reluctant to post the code I'll put you another example to show you what I mean.
Source to that entire script (it just moves you forward quite fast).
Code:
{$CLEO .CS}

0000:

REPEAT
    WAIT 0
UNTIL 0AFA:

0B34: samp register_client_command "SETCOLOR" to_label @SET

WHILE TRUE
    WAIT 0
    IF
        0B61:  samp is_local_player_spawned
    THEN
    
        actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@)
        0172: 3@ = actor $PLAYER_ACTOR Z_angle
        0AB1: call_scm_func @get3DXYZInFrontOf 6 XYZ 0@ 1@ 2@ Z_Angle 3@ Y_Angle 0.0  Distance 5.0 Return_XYZ_To 0@ 1@ 2@
        
        // draw line
        03F0: enable_text_draw 0
        0B55: convert_3D_coords 0@ 1@ 2@ to_screen 3@ 4@
        actor.StorePos($PLAYER_ACTOR, 5@, 6@, 7@)
        0B55: convert_3D_coords 5@ 6@ 7@ to_screen 5@ 6@
        0B67: render a 255 r 5@ g 6@ b 7@ to_argb 7@ // creates ARGB hex for "draw line" same principal as RGBA basically.
        0B68: render draw_line_point1 3@ 4@ point2 5@ 6@ width 5 color 7@
        IF
            KEY_DOWN 1
        THEN
            actor.PutAt($PLAYER_ACTOR, 0@, 1@, 2@)
        END   
        
    END   
END

:SET
5@ = 255
6@ = 0
7@ = 0
// vars values are set
SAMP.CmdRet()

:get3DXYZInFrontOf{X,Y,Z,ZA,YA,Distance}
{   
    Return:
        PosX-InFrontOf
        PosY-InFrontOf
        PosZ-InFrontOf
      
    Example: 0AB1: call_scm_func @get3DXYZInFrontOf 6 XYZ 1@ 2@ 3@ Z_Angle 4@ Y_Angle 5@  Distance 7.0 Return_XYZ_To 6@ 7@ 8@

}
3@ *= -1.0
02F6: 6@ = sine 3@
006B: 6@ *= 5@
005B: 0@ += 6@
02F7: 6@ = cosine 3@
006B: 6@ *= 5@
005B: 1@ += 6@
02F7: 6@ = cosine 4@
0073: 5@ /= 6@
02F6: 6@ = sine 4@
006B: 5@ *= 6@
005B: 2@ += 5@
0AB2: ret 3 0@ 1@ 2@
 

Attachments

  • Untitled.png
    Untitled.png
    63.9 KB · Views: 14
Status
Not open for further replies.
Top