CLEO Help Help with this (maybe springfield you can)

CLEO related
Status
Not open for further replies.

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
I'm trying to create something like the pimod but i'm stucked on this:

How to get the health and armor (lost) of the opponent and draw it on a box/bar? I know i can use the next opcodes:

Code:
038E: draw_box_position 320.0 224.0 size 640.0 448.0 RGBA 0 0 0 255

0B25: samp 2@ = get_player_health 1@

0B26: samp 2@ = get_player_armor 1@

but I want to know how to put the function of reduce that box when the opponent loses health or armor.
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
PopandaulX link said:
http://ugbase.eu/snippets/drawbar-for-everything/

or
0B25: samp 2@ = get_player_health 1@
3@ = 320.0
4@ = 2@
4@ /= 2.0
3@ -= 2@
038E: draw_box_position 3@ 224.0 size 2@ 5.0 RGBA 0 0 0 255
- not sure, but this should work

You know, you'll use 038E: with the size of the health, but it will decrease to inside, so you have to set it position to the left.
Yes but not working, what is wrong?. Here is that part of the code:

Code:
0B25: samp 29@ = get_player_health 25@ // this get the health of the aimed player
3@ = 575.0   //this is the position of the bar moved to the lef as you say
0087: 4@ = 29@ // (float)        
4@ /= 2.0
0063: 3@ -= 29@  // (float)
038E: draw_box_position 575.3 141.0 size 60.9 7.7 RGBA 0 0 0 255       //black box
038E: draw_box_position 575.3 141.0 size 56.9 5.2 RGBA 255 0 0 255   //red box
038E: draw_box_position 3@ 141.0 size 29@ 5.2 RGBA 0 255 0 255 //green box moved to the left as you say but is not working, it doesn't draw.

If i change that to this code, it doesn't draw the bar.

Code:
0B25: samp 29@ = get_player_health 25@
3@ = 575.0
0087: 4@ = 29@ // (float)
4@ /= 2.0
0063: 3@ -= 29@  // (float)
038E: draw_box_position 575.3 141.0 size 60.9 7.7 RGBA 0 0 0 255
038E: draw_box_position 3@ 141.0 size 29@ 5.2 RGBA 255 0 0 255
 

PopandaulX

Active member
Joined
Jul 15, 2013
Messages
189
Reaction score
1
It doesn't draw the bar because you deleted this:
038E: draw_box_position 3@ 141.0 size 29@ 5.2 RGBA 0 255 0 255
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
PopandaulX link said:
It doesn't draw the bar because you deleted this:
038E: draw_box_position 3@ 141.0 size 29@ 5.2 RGBA 0 255 0 255
Not working, it draws the black box/bar, not the green or red. I want to get the HP of the player and draw it on the bar/box. Look the pics:

Here is with 100HP:
33mSqXj.png


Here is with 42HP: but as you can see, the bar/box is same as 100HP because the box/bar is drawed there. I want to change that box/bar as the image below.
o4u99Oh.png


The bar must be something like this:
Um9QkiL.png


Here is the code but not working!:

Code:
0B25: samp 29@ = get_player_health 25@
3@ = 575.0
0087: 4@ = 29@ // (float)
4@ /= 2.0
0063: 3@ -= 29@  // (float)
038E: draw_box_position 575.3 141.0 size 60.9 7.7 RGBA 0 0 0 255
038E: draw_box_position 575.3 141.0 size 56.9 5.2 RGBA 255 0 0 255 //if i remove this box, the next box doesn't appears just shows the black box (the first)
038E: draw_box_position 3@ 141.0 size 29@ 5.2 RGBA 255 0 0 255
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
springfield link said:
Why not use function provided in snippet above?

Because i don't know how to store the health of the aimed player to the value.

PopandaulX link said:
If the max size of the box is 141, than 29@ *= 1.41...
and 3@ -= 4@, not 29@

I don't understand can you explain that? Or maybe change the code?
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
226
Location
( ͡° ͜ʖ ͡°)
Code:
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY





WHILE TRUE
    WAIT 0
    IF
    0AB0: 2
    THEN
        IF
        0AD2: 0@ = player $PLAYER_CHAR targeted_actor //IF and SET
        THEN
            0B2B: samp 1@ = get_player_id_by_actor_handle 0@
            0B25: samp 2@ = get_player_health 1@
            03F0: enable_text_draw 1
            0AB1: call_scm_func @drawBar 6 coords_X 450.0 coords_Y 450.0 value 2@ size X 40.0 Y 4.0 thickness 2.0
        END
    END
END




:drawBar
13@ = 100.0
0073: 13@ /= 3@ // (float)
0073: 2@ /= 13@ // (float)
0087: 11@ = 3@ // (float)
0087: 12@ = 4@ // (float) 
005B: 11@ += 5@  // (float)
005B: 12@ += 5@  // (float)     
038E: draw_box_position 0@ 1@ size 11@ 12@ RGBA 0 0 0 255
038E: draw_box_position 0@ 1@ size 3@ 4@ RGBA 100 0 0 255
0087: 10@ = 2@ // (float)
0017: 10@ /= 2.0
0017: 3@ /= 2.0
005B: 0@ += 10@  // (float)
0063: 0@ -= 3@  // (float)
038E: draw_box_position 0@ 1@ size 2@ 5.0 RGBA 255 0 0 255
0AB2: ret 0
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
Ahhh i put the player health 2@ after the call  :hellno: i will try it.

Edit: not working. It draw the bar but not with the health.  :table_flip:
 

renko

Active member
Joined
Jul 8, 2014
Messages
58
Reaction score
0
pepeelpubero link said:
Ahhh i put the player health 2@ after the call  :hellno: i will try it.

Edit: not working. It draw the bar but not with the health.  :table_flip:
I have the same problem, i have the box empty
 
Status
Not open for further replies.
Top