Jump to content
xisto Community
Sign in to follow this  

How To Code In Gta: San Andreas San Andreas Coding Tutorial

Recommended Posts

Okay now I will teach you how to code main.scm - This is useful for making missions although we won't get into that today. Today we are just going to learn the basics...


The easiest thing to do is set spawn locations. These can be spawn locations of Cars, Weapons, Pickups and more...


As the easiest one is pickups, we will learn that first...



A pickup in San Andreas is an item that helps the player. So this can be health, armour or even adrenaline (Although as this was removed by Rockstar you can't spawn them. Yet...)


These are the tools you will need...


- A decent coordinate teller. I would suggest GTASA Control Center but you can use anything you want...


- Get A Good Mission Builder!!! You will need Barton Warterducks Mission Builder (Search for it in Google)



So now we have these tools and hopefully you know how to use your coordinates teller. Now we need to configure the Mission Builder to work properly...


After extracting the files for mission builder you will need to find a file called: SASCM.INI . When you do open it in a Notepad.


Now go down to the bottom and paste this...

0A4A=2,%1h% %2h%0A4B=0,

Now you need to back up some GTA files... The files you will need to back up are...








Finally, copy main.scm and script.img to a new folder inside your mission builders installation folder. Lets call the new folder 'My Project 1'



Now we can start editing our script but first we need to decompile it...


Run SABuilder (The mission builder) and go to the corner of screen and click File > Open


Change the dropdown menu that says Text Document (*.txt) to All Files (*.*) then navigate to the folder you created ('My Project 1')


You will then see main.scm and script.img since you just copied them there...

Select main.scm and click ok


You then need to save the text file somewhere... Just click ok on the folder you copied the other files to..



Now the fiddly bit is over lets do some coding!



There are several boring things you need to know about a simple line of coding that I probably should teach you... So let's get to it...


Hold Ctrl + F on your keyboard to open the find window. Then type: BRIBE

Press enter and you should come to DEFINE OBJECT BRIBE but that isn't what we want. Search again to find the following line:


0213: $3345 = create_pickup #BRIBE type  15 at  2743.0  1316.0  8.0


Now to explain and change this code...


Copy the line and paste it onto a new line. Now we can edit this line...


This is an opcode. I think it describes what it does but im not too sure. I just know every item has a unique opcode...



This looks confusing but it is quite simple. It's just a name that Rockstar gave it. We can name it anything really as long as it still has $ in front of it and only contains letters and numbers. We shall name this MYBRIBE1



This is just what the code does. It creates a pickup...



This is what the object is... It's a Police Bribe...


type 15
This means that this is a Free object. if you change 15 to 1 then you will need to buy it...


at  2743.0  1316.0  8.0

This is what you will have to change most... These are co-ordinates and these are the reason we needed a coordinate teller (GTASA Console)


So we need to get our co ordinates to choose where the pickup will be cause at the moment it is at the same place as the other one...


Run your game with your co ordinate teller running (GTASA Console) and find where you want to put a wanted star. Make it easy to remember as you are just testing. Let's say in the middle of Grove Street. Stand exactly where you want the Bribe to be...


Now alt+TAB or windows key out of San Andreas and go to your coordinate teller and click 'Read From GTASA' or 'Get Coordinates' or whatever it says... (To get them on GTASA console go to the Locations tab)


Now you'll need to copy and paste the answers...


So the original co ordinates were:


at  2743.0  1316.0  8.0
And this is what these co ordinates are...

at  X: 2743.0 Y: 1316.0  Z: 8.0

You will notice your coord teller also has these so paste each axis (XYZ) over the existing coordinates.


I usually delete all 0's at the very end of the coordinates besides from the last one as it saves space and isn't needed.


Now go to the very top of the code page to find a DEFINE MEMORY thing. There should be a number in the 4000's or something. You'll need to make this higher to compile your code...


Change it to about 50000 or over. Now compile by going to Run > Compile or hit F7.

It may go weird for a minute or so...

When it has finished go to where you copied you main.scm to and copy both the main.scm and script.img and paste it into you San Andreas\Data\Script directory and start a new game .


If this works you will be playing the game with no problems. Go to where you got the cootdinates from (Grove street if you did what I said...) and you will see your new pickup!


WELL DONE. You've made your first script!!!!


If the game crashes after a while of playing it you need to reduce the DEFINE MEMORY thing you changed. Make the number lower a bit or get more RAM and you should be sorted!

Share this post

Link to post
Share on other sites

What a coincidence hahaha I was looking for this a while back and couldn't find it. I always wanted to make missions in GTA: SA. Thanx for the tut and post a link when you made the mission maker tut. This might be off topic but do you have by any chance SA MP? San Andreas Multiplayer?

Share this post

Link to post
Share on other sites

Which line are you using at the moment? I'm not sure. I didn't make this thread, a friend of mine made it using my Trappy account. :P

Share this post

Link to post
Share on other sites

ok, when u said copy the bribe line and paste it into a new line... where do you want me to paste the new line?

Just post the line under the line you're copying from. That's where all spawning lines should be placed as it runs before anything else in the game. Edited by -Sky- (see edit history)

Share this post

Link to post
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
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.