The Game Modding Community - Since 2001

Mission Coding for Dummies - Status Bars

A Tutorial for Grand Theft Auto: San Andreas

Status Bars This tutorial is about Status Texts, or "bars". You can find them in SA missions like "Drive-By" and "supply-lines". CODE > :SWEET4_47 Model.Load(#GREENWOO) 038B: load_requested_models :SWEET4_103 if not Model.Available(#GREENWOO) else_jump @SWEET4_152 wait 0 jump @SWEET4_103 :SWEET4_152 1@ = 2508.16 2@ = -1666.47 3@ = 13.0 4@ = 16.0 0395: clear_area 1 at 1@ 2@ 3@ range 6.0 5@ = Car.Create(#GREENWOO, 1@, 2@, 3@) 0229: set_car 5@ color_to 59 34 Car.Angle(5@) = 4@ Car.Health(5@) = 1450 $health = Car.Health(5@) This code is just spawning a vehicle, the Greenwood. In addition the health of the car is stored in variable $health. First I will explain the principle. The bar goes from 0 to 100, it are percentages. The initial health of the car is 1450. Under the 250, the car will be destroyed. So 250 will be the 0 of the bar. When 250 is in the bar 0, then the 1450 is 1200 (1450 - 250). Because you have only from 0 to 100, you have to divide it by 12. You have to code it like this: CODE > 0084: $health2 = $health // integer values and handles if $health2 > 250 // integer values else_jump @SWEET4_11472 $health2 -= 250 // integer values :SWEET4_11472 $health2 /= 12 // integer values Before you can subtract 250, you have to check if it is more then 250. Otherwise it will be a negative number, which can't be in the bar. If the number is beneath the 250, you have to go to the next label (with the jump). If the number is above the 250, you have to subtract the 250. Then you have to divide the number by 12, so it is a number between the 0 and the 100. CODE > 0151: remove_status_text $health2 03C4: set_status_text_to $health2 1 'SWE4_08' // CAR HEALTH This is the code of the "bar". You won't see the "car health" text, because the GXT is not correct, but we will ignore that here. You can place a 0 instead of the 1, but then it will be displayed as number ingame, and it won't be a bar. CODE > repeat wait 0 ms $health = Car.Health(5@) 0084: $health2 = $health // integer values and handles if $health2 > 250 // integer values else_jump @SWEET4_11472 $health2 -= 250 // integer values :SWEET4_11472 $health2 /= 12 // integer values until $health < 250 0151: remove_status_text $health2 end_thread We want to make a bar until the car is wrecked, so when the variable is 0, the bar has to disappear. This is a repeat-wait-until structure, so it has to repeat everything from the repeat-command until the condition is true. The condition is that $health has to be below the 250. He has to check the car health every time, and has to make it a number between 0 and 100. That's why it has to be between the repeat and until. When you don't do that, it will be the same number, because the variable $health2 won't be changed. So you have to wait until the health of the car is below the 250, then the car will be wrecked. After that you have to let the bar disappear with the 0151 opcode. After that you have to use the end_thread opcode, because else the game will crash if you don't properly end tha thread. [When you add the code in a stripped SCM file, you will see the bar.]( "")


None found


Share banner
Image URL:
HTML embed code:
BB embed code:
Markdown embed code:


Original Authors


Arman Ossi Loko avatar
Arman Ossi Loko username pic Joined 11y ago
65,381 points Ranked 57th
65 medals 11 legendary 16 rare
  • GTAV First Adopter Medal icon
  • Submitted 15 Tools Medal icon
  • Submitted 30 Tutorials Medal icon
  • 1st place - 2015 Uberstyles Contest Medal icon
  • Achieved Admin clearance Medal icon
  • 15+ Entries! GameBanana’s Christmas Giveaway 2015 Medal icon

Arman Ossi Loko avatar
Arman Ossi Loko
KOPASSUS Incorporated Flag
KOPASSUS Incorporated

Are you the owner? Request Ownership
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!



Difficulty Level
Beginner Difficulty



  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+


  • 0 Posts
  • 6y Submitted
  • 4y Modified


  • Not yet rated
Sign up to access this!

Attention Gamer! Mascot

GameBanana is one of the oldest mod sites on the net. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation - send modders points.
  • Post: Give modders your thoughts on their work.
  • Vote: Help your favorite modders win monthly awards.
  • Rate: Rate mods and help them stand out.
  • Flag: Alert moderators and warn members of problems with mods.
  • Watch: Get notified when mods are updated.

Sound fun? Sign up now!

Already a Bananite? Login tracking pixel