Jump to content

health bar


TheJeweleR

Recommended Posts

hi guys.I make a new my mod.

 

Description

 

When you drove you car you saw a you car's health bar..

 

I can create it but it isn't down or up.It everytime set.

 

How can i make it?

 

I want: If somebody hit your car,Your car health down. etc. confused.gif

 

As if the dynamic object...

 

Link to comment
https://gtaforums.com/topic/444341-health-bar/
Share on other sites

 

Have a look at this tutorial. smile.gif

very thanks man.I don't look all topics because i cant speak perfect english biggrin.gif

 

I didn't understand that lessons :S (only status bar )

 

can you make dinamic bar for me? please..

 

my codes

 

 

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------thread 'bar' :SWEET4_47Model.Load(#GREENWOO)038B: load_requested_models:SWEET4_103if not Model.Available(#GREENWOO)else_jump @SWEET4_152wait 0jump @SWEET4_103:SWEET4_1521@ = 2508.162@ = -1666.473@ = 13.04@ = 16.00395: clear_area 1 at 1@ 2@ 3@ range 6.05@ = Car.Create(#GREENWOO, 1@, 2@, 3@)0229: set_car 5@ color_to 59 34Car.Angle(5@) = [email protected](5@) = 1450$health = Car.Health(5@)wait 0 ms$health = Car.Health(5@)0084: $health2 = $health // integer values and handlesif$health2 > 250 // integer valueselse_jump @SWEET4_11472$health2 -= 250 // integer values:SWEET4_11472$health2 /= 12 // integer valuesif  $health < 250jf @SWEET4_114720151: remove_status_text $health2end_thread

 

Link to comment
https://gtaforums.com/topic/444341-health-bar/#findComment-1059851284
Share on other sites

 

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------0000: NOP 03A4: name_thread 'TESTBAR' 0007: 1@ = 2508.16 0007: 2@ = -1666.47 0007: 3@ = 13.0 :TESTBAR_430001: wait 10 ms 00D6: if 0256:   player $PLAYER_CHAR defined 004D: jump_if_false @TESTBAR_43 00D6: if 03EE:   player $PLAYER_CHAR controllable 004D: jump_if_false @TESTBAR_43 00D6: if 0038:   $ONMISSION == 0 004D: jump_if_false @TESTBAR_43 00D6: if 00EC:   actor $PLAYER_ACTOR 0 near_point 1@ 2@ radius 80.0 80.0 004D: jump_if_false @TESTBAR_43 0050: gosub @TESTBAR_319 0395: clear_area 1 at 1@ 2@ 3@ radius 6.0 00A5: 5@ = create_car #GREENWOO at 1@ 2@ 3@ 0229: set_car 5@ primary_color_to 59 secondary_color_to 34 0175: set_car 5@ Z_angle_to 4@ :TESTBAR_1900001: wait 10 ms 00D6: if 0256:   player $PLAYER_CHAR defined 004D: jump_if_false @TESTBAR_302 00D6: if 00DB:   actor $PLAYER_ACTOR in_car 5@ 004D: jump_if_false @TESTBAR_302 00D6: if 8119:   not car 5@ wrecked 004D: jump_if_false @TESTBAR_302 0227: $CARHEALTH = car 5@ health 0014: $CARHEALTH /= 10 03C4: set_status_text $CARHEALTH type 1 GXT 'SWE4_08' // global_variable  // CAR HEALTH00D6: if 001A:   200 > $CARHEALTH 004D: jump_if_false @TESTBAR_302 0002: jump @TESTBAR_190 :TESTBAR_3020151: remove_status_text $CARHEALTH 01C3: remove_references_to_car 5@ // Like turning a car into any random car 0002: jump @TESTBAR_43 :TESTBAR_3190247: load_model #GREENWOO :TESTBAR_3240001: wait 10 ms 00D6: if 0248:   model #GREENWOO available 004D: jump_if_false @TESTBAR_353 0051: return :TESTBAR_3530002: jump @TESTBAR_324 

 

 

havn't teted it yet

Edited by The_Siggi
Link to comment
https://gtaforums.com/topic/444341-health-bar/#findComment-1059851394
Share on other sites

You should test your codes before posting it.

 

First, if you do it like this, it won't work at all. You have to change this:

 

00D6: if00DB:   actor $PLAYER_ACTOR in_car 5@004D: jump_if_false @TESTBAR_302

 

 

Into:

 

00D6: if00DB:   actor $PLAYER_ACTOR in_car 5@004D: jump_if_false @TESTBAR_190

 

 

But after this, it is working only when you are inside that car! So if someone shoots at you, or (for test purposes) you will get out of the car and hit it, the bar stays the same (until you get in the car, then it will go immediately to the right health).

The most simple solution for this problem is to move the check if the player is in the car, before the loop where you check the health of the car.

Link to comment
https://gtaforums.com/topic/444341-health-bar/#findComment-1059851849
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.