Welcome!

On this page, you'll be able to research and learn how to use basic native functions for GTA V. I'm aiming to help new modders learn the ropes but also supply useful information for experienced modders to expand their scripts and give some mod ideas. These are all written by me so feel free to email me with ideas on new topics: tustin@nextgenupdate.com.

Player Natives Modifying peds and network players

Introduction


Player natives are probably the most commonly used functions in the game. They allow you to change properties such as health, armour, weapons, etc. Most of these work on network players as well.

There are two common functions in the game: PLAYER_ID and PLAYER_PED_ID. These can be confusing for new modders, especially since it might seem random which functions use either one. Here's an easy way to remember each one:

PLAYER_ID - Used in functions that have "PLAYER" in the name, such as "SET_PLAYER_MODEL".

PLAYER_PED_ID - Used in entity based functions, such as "SET_ENTITY_COORDS" or "SET_ENTITY_VISIBLE".

These functions both have a return type of int, which will be the id of the player/entity. Here are some examples of the functions in action:

PLAYER_ID:

The function above simply stores the PLAYER_ID into a variable "player", then using this "player" variable to set the wanted level to zero. You don't need to create a variable, however, but it just makes the code look a lot cleaner rather than calling PLAYER_ID over and over.

PLAYER_PED_ID: This function again stores the id into a variable. Notice this time we're using PLAYER_PED_ID so we have our entity id, rather than just our player id. Then we call SET_ENTITY_VISIBLE, passing our "ped_id" variable, and passing false to make ourself invisible.

Basic Mod Toggles


Now that you have an understand about how player mods are set, lets dig into using these functions more fluidly. If your goal is to make a trainer menu, then you'll want a way for the user to turn a mod on and off. Why wouldn't you?

This is fairly easy to do and I'll demonstrate it here with invisiblity yet again. OK, so if the comments weren't exactly helpful, I'll try to explain better. Again, we initialize an int variable for our ped id. This time we also create another variable, a bool, to remember if we're currently visible or not. When the function "toggle_invisiblity" is called, it reverses the value, then passes that value into the SET_ENTITY_VISIBLE function. There are other ways to set it like this, but this is a much shorter way (you could even do it with 1 line of code, but this will do for now).

Tunables Modifying global values

Overview


Tunables are something I've always enjoyed messing with. Most people probably recognize these from around December 2013 when everyone (official firmware or custom firmware) could modify these using a custom server and increase their cash and RP multipliers, increased health and more. These were quickly patched and from then on, the only way to modify these in game is using memory editing.

Tunables are unique as they basically allow Rockstar to change and "tune" (get it?) these values at any time. If Rockstar feels like giving everyone 2x RP and cash for the weekend, they can do it with a few changes on their server. One major thing these tunables also control are DLC content. The Christmas, Independence and Valentine's DLC are all controlled via tunable values. With the right values and tunable indices, you can turn on these old DLC yourself.

How To Edit


As I mentioned above, the only way to edit these values (and play with people) nowadays is editing them in memory. If you're not familiar with memory editing, feel free to click here to view and download my tunable editing program which makes this process a lot easier. If you're interested in learning how they work, keep reading!

Tunables are held within a table further out in memory. This table is dynamic, meaning it has no specific address each time. The easiest way to find this area is using a pointer address, which holds bytes which when used as an address, take you to a specific point in memory. For example, if address 0x10700000 contains the bytes "32 A5 63 F1", you can combine these bytes together to make "0x32A563F1", which may be the address for something in memory.

The pointer for the BLES version of GTA on 1.24 is 0x1E60274. Going there and then jumping to whatever bytes are there will take you 0x04 bytes before the table. Here's a quick function to read the bytes at that pointer and return it:
This function reads the bytes as an int and adds 4 to it (like I mentioned, the pointer takes you 0x04 bytes IN FRONT of the table).

Now that you know where the table is, how do you know which values are what? This is where indices come in. Before I start, I want to thank Choco for showing me this a long time ago, which has helped me immensely with finding these. Each tunable has an index, which is used by the scripts for Global variables (Globals are a whole other story that you don't need to worry about).

The only real way to find these indices is using the decompiled script file "tunables_processing". This file contains all the tunables and their index + value. However, it's not that easy anymore. Prior to 1.23, Rockstar used to keep ALL the tunable names in plaintext. Meaning you could just search "TURN_SNOW_ON_OFF" and find the index for it. I made a tutorial on NextGenUpdate showing how to find indices, and Rockstar subsequently changed this in the next update. Whoops!

Their fix was good but didn't really change much. What they did was started hashing each tunable name using an algorithm called Jenkins One-at-a-time, or joaat. Hashing is fun because you can't just pass the hash into the function again to get the original text and call it a day. There's only two ways to get the string of a hash: know the string already, or use brute force. The first one was the most obvious because we already had all the tunable names.

So what I did was write a program that would grab each string from an old tunables_processing file, hash those strings, match them up with the hashes in the newest tunables_processing file, and replace the hashes with the original string. Doing this makes it so you can find all of the older tunable indices, but unfortunately you cannot get new tunables using this method.

I publish the dehashed tunable_processing file for each update, which you can find by visiting this page. Now what the hell do I do with this?

The file itself is in assembly, so it might be confusing for some of you to understand. A tunable structure looks like this: The structure itself is pretty basic. When you search for a tunable name, you'll see it being pushed onto the stack (the instruction should be PushString but remember, it used to be a hash). The pGlobal3 you can avoid, this is just setting the script up to use this global value. The GetImmediateP2 is the jackpot. This is your tunable index. As you can see, for TURN_SNOW_ON_OFF on 1.24, the index is 4713. Now how do you set this in memory?!

I have a function I'll share, but I'll explain it first. So above we have the function to get the tunables table address. At index 4713 of this table is the snow tunable value. You have to remember that we're dealing with memory here, so you cannot just do "FindTunablesPointer() + 4713" and expect to find the value. Since the values are bool, int or float, they are 4 bytes in memory. All you need to do is take this index and multiply it by 4. Bingo! This will now take you to the actual value which you can then poke. Here's the function I promised earlier: That's all you need! You can add this to your SPRX to set tunables within a menu or whatever else you have. If you plan on using this in C#, you need to modify it to use a library like TMAPI or PS3Lib. You cannot poke addresses like this with an application.

If you do plan on using this, please at the very least give credit to both Choco and I for doing the research into tunables. The functions were both written myself, along with the dehashed file.

GTA V Dumps

This page contains data dumps from GTA V. These lists are useful if you plan on making a script that allows model changing, object spawning and more. Credit goes to ECB2 for the original lists (this is just a backup) and ap ii intense for the vehicle hashes. Also big thanks to the contributers on GTA: Forums. These are a mix of PC and PS3 dumps so you might have to pick and choose.

Vehicle dump

Peds dump

Props dump

Colors dump

Pickups dump

Weapons dump

Particle Assets dump

Sprite dump Thanks to sodanakin (GTA: F)

Blip index dump Thanks to ScriptHookV .NET devs

Cutscene dump Thanks to TransmetTeam