Arrow left icon Back to Home

How GTA San Andreas got me into coding

Young me playing on the PlayStation 2

I was around 7 years old when I first played :habbo-icon_202: GTA: San Andreas on the PlayStation 2. The game came with the console when we bought it second hand, but my mom did not approve of me playing it (for obvious reasons). I played the missions occasionally when she was out, but never finished them, which was likely due to my age. My English was very limited at that time and I probably just didn’t understand the overall gist of the game. I just liked driving around and blowing up cars; the typical GTA kid experience.

Getting into San Andreas Multiplayer

Years later, when I was 12 years old, I found out that San Andreas on PC had much more to offer. People, as they do, found out ways to modify the original game in fun, but also practical ways. One of those mods was “GTA SA:MP” (San Andreas Multiplayer). It allowed you to play the game together with people from all around the world. Different “gamemodes” were custom developed by server owners, so the game suddenly became so much more than it already was. You could play:

I would describe GTA SA:MP to be more of a game engine, rather than a game itself. It’s like a blank canvas to a painter, like an empty book to a writer :habbo-icon_360:. Creations in SA:MP were limited to the developer’s creativity.

Learning to Code

If so many people could make cool and interesting stuff, why couldn’t I? SA:MP allowed you to load custom scripts made in :habbo-icon_361: PAWN, a C-like programming language. So I set forth to learn how to code PAWN scripts.

YouTube gave me the kickstart, but I especially learned a lot on the SA:MP Forums: a safe place where I could ask all my questions, think of it like the SA:MP version of StackOverflow. Replies were always supportive and helpful:

A reply from the SA:MP Forums
A reply from the SA:MP Forums
A reply from the SA:MP Forums
A reply from the SA:MP Forums

Okay… not always, but to be fair I was a clueless teenager asking the most obvious questions.

Basic scripting

I started out by making basic scripts. Here’s a snippet of one of my scripts from June 2nd 2013 (comments added for clarification):

Firework object

Object kmb_mine (ID: 2918)

// Registers a chat command "/firework"
// Creates an object ID 2918 (kmb_mine) at the player's position and launches it up
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/firework", cmdtext, true, 9) == 0)
	{
	    if(!IsPlayerInAnyVehicle(playerid))
	    {
		    if(!IsObjectMoving(firework))
		    {
		        new Float:pX, Float:pY, Float:pZ;
		  		GetPlayerPos(playerid, pX, pY, pZ);
		  		firework = CreateObject(2918, pX, pY, pZ, 0.0, 0.0, 100.0);
				MoveObject(firework, pX, pY + 16, pZ + 50, 25.0);
			}
			else
			{
			    SendClientMessage(playerid, -1, "{FF0000}** Please wait until your other firework is exploded **");
			}
		}
		else
		{
		    SendClientMessage(playerid, -1, "{FF0000}** You can't launch firework from your car **");
		}
  		return 1;
	}
	return 0;
}

// Once the object is done moving, delete it and create an explosion
// This gives the illusion of a firework
public OnObjectMoved(objectid)
{
    if(objectid == firework)
    {
        new Float:obX, Float:obY, Float:obZ;
		GetObjectPos(objectid, obX, obY, obZ);
		DestroyObject(firework);
		CreateExplosion(obX, obY, obZ, 0, 15.0);
    }
    return 1;
}

Another script I found in the archive, from July 27th 2013:

Faggio scooter

Faggio scooter in GTA San Andreas

// Once player presses KEY_CROUCH while riding a Faggio scooter, bump the scooter up, simulating a hydraulics effect
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (PRESSED(KEY_CROUCH))
	{
	    if(IsPlayerInAnyVehicle(playerid))
	    {
	        new faggio = GetPlayerVehicleID(playerid);
	        if(GetVehicleModel(faggio) == 462)
	        {
	            if(GetPVarInt(playerid, "faggio") == 0)
	            {
		            new Float:x, Float:y, Float:z;
		            GetVehiclePos(faggio, x, y, z);
		            SetVehiclePos(faggio, x, y, z + 1);
		            PutPlayerInVehicle(playerid, faggio, 0);
		            PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
		            SetPVarInt(playerid, "faggio", 1);
		            SetTimer("faggiotimer", 1000, 0);
				}
	        }
	    }
	}
	return 1;
}

forward faggiotimer(playerid);
public faggiotimer(playerid)
{
    SetPVarInt(playerid, "faggio", 0);
}

Learning more and more…

After years of SA:MP script development, I had gained quite some experience and started working on more advanced scripts and gamemodes. I also served as the Lead Developer on a large Roleplaying server at some point (GTA SA:RP - San Andreas Roleplay). I scripted custom events, weapons, systems, maps and more. I got to know new people, some of which I still speak to today. It was a good time.

More archived clips on my old YouTube channel

Saying farewell

In around September 2018 I stopped playing SA:MP. It was at this time when I started studying Software Engineering and moved on to mainly web development. The SA:MP community I was involved in also mostly fell apart, so what was once a vibrant and tight community, turned into memories and nostalgia :habbo-icon_141:.

Scripting for SA:MP was great fun. It helped me understand the core basics of programming and taught me skills such as debugging. Little did I know, at just 12 years old, I was laying the foundation for my to-be hobby and career.

Special thanks to: Shawn Jarvis, Armando Consalvo, Sean Johnson, Edward Pulaski, Smo Wang, Harvey McConnell, Sparke (Jay), Erei (Dylan), Daser Alabha, Frank Cooper, Rajj Patel, Erdem Johnson.


With Love,

Jay Cortez Signature

Jay Cortez

Ending this post with some nostalgic screenshots from my archive.

SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive
SA:MP Screenshot from my archive