The Game Modding Community - Since 2001

Mission Coding for Dummies - Cars

A Tutorial for Grand Theft Auto: San Andreas

Cars **Introduction** This tutorial is about an essential part of the game: cars. There are two ways of spawning cars: cargenerators, which spawn multiple times or just cars that spawn once. I will explain both. Cars that spawn multiple times Cargenerators are more easy to spawn then cars that spawn once, because you don't have to load and unload the models of the cars. This way the permanent cars in the game are spawned. The lines for the cargenerator: CODE > 014B: $PARKED_RHINO = init_parked_car_generator #RHINO -1 -1 1 alarm 0 door_lock 0 0 10000 at 2435.302 -1671.848 12.8007 angle 90.0 014C: set_parked_car_generator $PARKED_RHINO cars_to_generate_to 101 We will analyse this code. The first line: $PARKED_RHINO: a variable to which the car is assigned. #RHINO: model name of the car that you want to spawn. First -1: first color of the car. ( -1 = random color ) Second -1: secondary color of the car. ( -1 = random color ) The 1: the police thinks that it is your car. If it's a 0, then the police knows that you stole it. Alarm 0: the chance that the alarm will sound is 0%. If you make it 50, the chance is 50%. Door_Lock 0: the door isn't locked. Make it 1 and the car is locked. At the end are the x, y and z coords, and the angle of the car. Second line: $PARKED_RHINO: the variable holding the car that the opcode is meant for. 101: the car will spawn. If you make it a 0, the car won't spawn. You have to do this line always when you are making a cargenerator! Example in the stripped file There is another variant, which you can use to give the car a numberplate: CODE > 09E2: $grove = parked_car_generator_w_numberplate #GREENWOO 59 34 0 alarm 0 door_lock 0 0 10000 plate "GROVE4L_" at 2508.4824 -1670.6813 13.3812 angle 0.0 014C: set_parked_car_generator $grove cars_to_generate_to 101 The only differences are the code (09E2 instead of 014B), init_parked_car_generator instead of parked_car_generator_w_numberplate (it doesn't even matter!) and of course the "Plate...". After plate you can write what you want to have on the numberplate.(8 characters) Cars that spawn once This looks a lot like spawning an actor: CODE > //Load models 0247: load_model #GREENWOO 038B: load_requested_models :MODEL_LOAD if 8248: not model #GREENWOO available else_jump @MODEL_SPAWN wait 0 ms jump @MODEL_LOAD When you read the other tutorials, I think you don't need any explanation. CODE > :MODEL_SPAWN $greenwood = Car.Create(#GREENWOO, 2458.2483, -1659.0264, 13.3047) Car.Angle($greenwood)= 270.0 With this code you will spawn a Greenwood. The variable ("handle") of the car is "$greenwood". The model name is #GREENWOO (you can look it up in the vehicles.ide). After that are the x, y and z coord. The second line is angle of the vehicle. CODE > 0249: release_model #GREENWOO Of course we have to release the model. There are all kind of codes for cars that spawn only once. A few examples: CODE > 0674: set_car_model #GREENWOO numberplate "ABCDEFG" You can set a special numberplate. You have to use this opcode right before you create the car. CODE > 0119: car $greenwood wrecked You can ask if the car is wrecked, most used in a if-structure. With the $ you have to use the variable (handle) of the car. CODE > 0224: set_car $greenwood health_to 10000 When the number is higher, the car can take more damage. Of course you can vary with this. The greenwood is smoking when the number is 500. When it is 250, one small crash is enough to blow up the car (black smoke). When it is less then 250, the car explode without doing anything. 1000 is a realistic number for the car. The $greenwood is the variable of the car, defined by spawning the car. CODE > 00A6: destroy_car $greenwood With this car you can remove the car from the game. Just like with actors, a release model doesn't delete the car. For that, you have to use this opcode. Of course there are many more commands that's got to do with cars, because it is an essential part of the game. So when you want to do something with a car that isn't explained here, and that you don't know how to use it, feel free to ask!


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!

Greetings! 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.

Resistance is futile... Sign up now!

Already a Bananite? Login tracking pixel