[How-to] Using Labels!


#1

How to use labels

So, labels are pretty cool stuff that you can use to get localized text without having to add translations manually to your scripts. The primary caveat to using them is, if you can’t find one that says what you want, you can’t get a localized version.

Below is an example of what the label would look like in two languages (English and French):

English French

Note: I know they’re different, just assume the text in the French one has white text after “Havoc” as well :stuck_out_tongue:
Code used for screenshots
function show01D7DE21()
	local labelCollision = "collision_5cks2e0" -- resolves to 01D7DE21. No normal name so, got to use a collision
	
	BeginTextCommandDisplayHelp(labelCollision)
	
	--0x01D7DE21 = SN: ~a~ will pay $~1~ for this job.
	-- ~a~ is a playerName, and ~1~ is a float
	AddTextComponentSubstringPlayerName("~g~" .. GetPlayerName(PlayerId()) .."~s~" ) -- Player names can use colours and HTML :D Might as well make the player name green :P
	AddTextComponentFloat(100.3948, 2) -- 2 dp
	
	EndTextCommandDisplayHelp(0, 0, 1, -1)
end

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		show01D7DE21()
	end
end)

Now, to the actual tutorial part :slightly_smiling_face:

Where to find the labels

So, in order to use labels, you need to know where to find them.
This is where OpenIV comes in handy.
Open it up and navigate to GTA V\update\update.rpf\x64\data\lang.
Here will be a bunch of RPF files, open up the one you’re most comfortable (if you’re French, open up the French one).

RPF Files

Inside this file, you will see a bunch of gxt2 files which, contain the labels.
The one I will be using for this tutorial is global.gxt2 file but, you can do this on any (there’s even more language files in the DLC you can use, this isn’t limited to the labels in the base game).
Once you’ve found a file you’re interested in, I would suggest exporting it as a OXT file so you can search it better.

Exporting

This will create a file with the contents that look something like this:

Now, we can get to the juicy stuff.

Using labels

OK. So, now you have a label you want to use. How do you use it?

Well, it depends on where you want to use it.
For example, do you want to use it in a scaleform, in help text, or maybe in a subtitle.

Well, if you need to use some sort of BeginText("STRING") or a derivative of then, you can use labels!
For example, to display text in the top left corner of the screen you would do

BeginTextCommandDisplayHelp("STRING")
AddTextComponentSubstringPlayerName("Some text")
EndTextCommandDisplayHelp(0, 0, 1, -1)

Instead of "STRING" you can use the name of a label (if it has one) to use that instead.
For example, in the global.gxt2 file there is a line YT_UPLOAD_COMPLETE = Upload Complete this follows the format of <LABEL> = <LOCALIZED STRING>.
So, it we wanted to display “Upload Complete” (translated to the client’s language) in the top left corner we can do:

BeginTextCommandDisplayHelp("YT_UPLOAD_COMPLETE")
EndTextCommandDisplayHelp(0, 0, 1, -1)

Which, would display
Example: Upload complete

What if they don’t have a name

So, some labels (like the example at the top) don’t have names, only hashes.
For example, the label 0x001A2EA0 = General only has a hash.
We can use a program called HashCollider to find a string that (when hashed) churns out the same value.

So, to use the label 0x001A2EA0 we find a collision.

Dictionary match

As you can see, it’s found a label inside the dictionary that is already known so, we can use "pm_plane_general".

Now, you might not be so lucky.
For example, 0x00280626 = Vinewood Hills will show the following in the collider:

No dictionary match

In this case, you need to generate a collision and use this.
So, in order to use 0x00280626 we can use it’s collision below:

Random collision

BeginTextCommandDisplayHelp("collision_9gjs1b")
EndTextCommandDisplayHelp(0, 0, 1, -1)

Results in: Vinewood random collision

Parametrised labels

When looking through the labels, you might have noticed that some of them use fancy stuff such as ~a~ and ~1~.
These are placeholders that can be replaced with custom text/numbers when displaying them to the player.

~1~ Dynamic Number
~a~ Area Title / Dynamic String

To replace them, you have to call the ADD_TEXT_COMPONENT_* natives.

For example, if a label has ~a~ and you want to put a player’s name in there (or, text with colour and stuff) then you would call the ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME native.
If it has ~1~ it’ll want a float or a integer, choose which one you want and call it!

There’s a lot of ADD_TEXT_COMPONENT_* natives and I haven’t test them all out, experiment with them and see what you can do.

Using a label inside a label

So, above we talked about using parameters inside labels. We can use labels inside of labels!
Yes, you hear me right, if the game has a label for it you can use it inside another label.

For example, let’s say we want to use the label GB_ASLT_GO = Go to ~a~..
It wants a string.
But, we want to use a place name (after all, we’re localizing stuff so, it’s only right to get a translated place name).

So, we find a label we want to use (let’s say GB_ASLT_GO1 = ~y~Fort Zancudo).

We can call the ADD_TEXT_COMPONENT_SUBSTRING_TEXT_LABEL native.

BeginTextCommandDisplayHelp("GB_ASLT_GO")

AddTextComponentSubstringTextLabel("GB_ASLT_GO1")

EndTextCommandDisplayHelp(0, 0, 1, -1)

Results in: Label inside label

Or, you can use a collision, for example

BeginTextCommandDisplayHelp("GB_ASLT_GO")

AddTextComponentSubstringTextLabel("collision_9gjs1b")

EndTextCommandDisplayHelp(0, 0, 1, -1)

Which will result in: Collision inside label

Weapon labels

Someone asked me if there was a way to get a weapon’s display name. Unfortunately there’s no native that can do this so, I’ve written a script that you can use to get the label for a weapon.

This is not a complete list and, there’s probably weapons that show as “Invalid” (as they haven’t been added).

weapon_hash_to_label.lua
local WEAPON_HASH_TO_LABEL = {
    [tostring(GetHashKey("WEAPON_UNARMED"))] = "WT_UNARMED",
    [tostring(GetHashKey("WEAPON_ANIMAL"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_COUGAR"))] = "WT_RAGE",
    [tostring(GetHashKey("WEAPON_KNIFE"))] = "WT_KNIFE",
    [tostring(GetHashKey("WEAPON_NIGHTSTICK"))] = "WT_NGTSTK",
    [tostring(GetHashKey("WEAPON_HAMMER"))] = "WT_HAMMER",
    [tostring(GetHashKey("WEAPON_BAT"))] = "WT_BAT",
    [tostring(GetHashKey("WEAPON_GOLFCLUB"))] = "WT_GOLFCLUB",
    [tostring(GetHashKey("WEAPON_CROWBAR"))] = "WT_CROWBAR",
    [tostring(GetHashKey("WEAPON_PISTOL"))] = "WT_PIST",
    [tostring(GetHashKey("WEAPON_COMBATPISTOL"))] = "WT_PIST_CBT",
    [tostring(GetHashKey("WEAPON_APPISTOL"))] = "WT_PIST_AP",
    [tostring(GetHashKey("WEAPON_PISTOL50"))] = "WT_PIST_50",
    [tostring(GetHashKey("WEAPON_MICROSMG"))] = "WT_SMG_MCR",
    [tostring(GetHashKey("WEAPON_SMG"))] = "WT_SMG",
    [tostring(GetHashKey("WEAPON_ASSAULTSMG"))] = "WT_SMG_ASL",
    [tostring(GetHashKey("WEAPON_ASSAULTRIFLE"))] = "WT_RIFLE_ASL",
    [tostring(GetHashKey("WEAPON_CARBINERIFLE"))] = "WT_RIFLE_CBN",
    [tostring(GetHashKey("WEAPON_ADVANCEDRIFLE"))] = "WT_RIFLE_ADV",
    [tostring(GetHashKey("WEAPON_MG"))] = "WT_MG",
    [tostring(GetHashKey("WEAPON_COMBATMG"))] = "WT_MG_CBT",
    [tostring(GetHashKey("WEAPON_PUMPSHOTGUN"))] = "WT_SG_PMP",
    [tostring(GetHashKey("WEAPON_SAWNOFFSHOTGUN"))] = "WT_SG_SOF",
    [tostring(GetHashKey("WEAPON_ASSAULTSHOTGUN"))] = "WT_SG_ASL",
    [tostring(GetHashKey("WEAPON_BULLPUPSHOTGUN"))] = "WT_SG_BLP",
    [tostring(GetHashKey("WEAPON_STUNGUN"))] = "WT_STUN",
    [tostring(GetHashKey("WEAPON_SNIPERRIFLE"))] = "WT_SNIP_RIF",
    [tostring(GetHashKey("WEAPON_HEAVYSNIPER"))] = "WT_SNIP_HVY",
    [tostring(GetHashKey("WEAPON_REMOTESNIPER"))] = "WT_SNIP_RMT",
    [tostring(GetHashKey("WEAPON_GRENADELAUNCHER"))] = "WT_GL",
    [tostring(GetHashKey("WEAPON_GRENADELAUNCHER_SMOKE"))] = "WT_GL_SMOKE",
    [tostring(GetHashKey("WEAPON_RPG"))] = "WT_RPG",
    [tostring(GetHashKey("WEAPON_PASSENGER_ROCKET"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_AIRSTRIKE_ROCKET"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_STINGER"))] = "WT_RPG",
    [tostring(GetHashKey("WEAPON_MINIGUN"))] = "WT_MINIGUN",
    [tostring(GetHashKey("WEAPON_GRENADE"))] = "WT_GNADE",
    [tostring(GetHashKey("WEAPON_STICKYBOMB"))] = "WT_GNADE_STK",
    [tostring(GetHashKey("WEAPON_SMOKEGRENADE"))] = "WT_GNADE_SMK",
    [tostring(GetHashKey("WEAPON_BZGAS"))] = "WT_BZGAS",
    [tostring(GetHashKey("WEAPON_MOLOTOV"))] = "WT_MOLOTOV",
    [tostring(GetHashKey("WEAPON_FIREEXTINGUISHER"))] = "WT_FIRE",
    [tostring(GetHashKey("WEAPON_PETROLCAN"))] = "WT_PETROL",
    [tostring(GetHashKey("WEAPON_DIGISCANNER"))] = "WT_DIGI",
    [tostring(GetHashKey("GADGET_NIGHTVISION"))] = "WT_NV",
    [tostring(GetHashKey("GADGET_PARACHUTE"))] = "WT_PARA",
    [tostring(GetHashKey("OBJECT"))] = "WT_OBJECT",
    [tostring(GetHashKey("WEAPON_BRIEFCASE"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_BRIEFCASE_02"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_BALL"))] = "WT_BALL",
    [tostring(GetHashKey("WEAPON_FLARE"))] = "WT_FLARE",
    [tostring(GetHashKey("WEAPON_ELECTRIC_FENCE"))] = "WT_ELCFEN",
    [tostring(GetHashKey("VEHICLE_WEAPON_TANK"))] = "WT_V_TANK",
    [tostring(GetHashKey("VEHICLE_WEAPON_SPACE_ROCKET"))] = "WT_V_SPACERKT",
    [tostring(GetHashKey("VEHICLE_WEAPON_PLAYER_LASER"))] = "WT_V_PLRLSR",
    [tostring(GetHashKey("AMMO_RPG"))] = "WT_A_RPG",
    [tostring(GetHashKey("AMMO_TANK"))] = "WT_A_TANK",
    [tostring(GetHashKey("AMMO_SPACE_ROCKET"))] = "WT_A_SPACERKT",
    [tostring(GetHashKey("AMMO_PLAYER_LASER"))] = "WT_A_PLRLSR",
    [tostring(GetHashKey("AMMO_ENEMY_LASER"))] = "WT_A_ENMYLSR",
    [tostring(GetHashKey("WEAPON_RAMMED_BY_CAR"))] = "WT_PIST",
    [tostring(GetHashKey("WEAPON_BOTTLE"))] = "WT_BOTTLE",
    [tostring(GetHashKey("WEAPON_GUSENBERG"))] = "WT_GUSENBERG",
    [tostring(GetHashKey("WEAPON_SNSPISTOL"))] = "WT_SNSPISTOL",
    [tostring(GetHashKey("WEAPON_VINTAGEPISTOL"))] = "WT_VPISTOL",
    [tostring(GetHashKey("WEAPON_DAGGER"))] = "WT_DAGGER",
    [tostring(GetHashKey("WEAPON_FLAREGUN"))] = "WT_FLAREGUN",
    [tostring(GetHashKey("WEAPON_HEAVYPISTOL"))] = "WT_HEAVYPSTL",
    [tostring(GetHashKey("WEAPON_SPECIALCARBINE"))] = "WT_RIFLE_SCBN",
    [tostring(GetHashKey("WEAPON_MUSKET"))] = "WT_MUSKET",
    [tostring(GetHashKey("WEAPON_FIREWORK"))] = "WT_FWRKLNCHR",
    [tostring(GetHashKey("WEAPON_MARKSMANRIFLE"))] = "WT_MKRIFLE",
    [tostring(GetHashKey("WEAPON_HEAVYSHOTGUN"))] = "WT_HVYSHOT",
    [tostring(GetHashKey("WEAPON_PROXMINE"))] = "WT_PRXMINE",
    [tostring(GetHashKey("WEAPON_HOMINGLAUNCHER"))] = "WT_HOMLNCH",
    [tostring(GetHashKey("WEAPON_HATCHET"))] = "WT_HATCHET",
    [tostring(GetHashKey("WEAPON_COMBATPDW"))] = "WT_COMBATPDW",
    [tostring(GetHashKey("WEAPON_KNUCKLE"))] = "WT_KNUCKLE",
    [tostring(GetHashKey("WEAPON_MARKSMANPISTOL"))] = "WT_MKPISTOL",
    [tostring(GetHashKey("WEAPON_MACHETE"))] = "WT_MACHETE",
    [tostring(GetHashKey("WEAPON_MACHINEPISTOL"))] = "WT_MCHPIST",
    [tostring(GetHashKey("WEAPON_FLASHLIGHT"))] = "WT_FLASHLIGHT",
    [tostring(GetHashKey("WEAPON_DBSHOTGUN"))] = "WT_DBSHGN",
    [tostring(GetHashKey("WEAPON_COMPACTRIFLE"))] = "WT_CMPRIFLE",
    [tostring(GetHashKey("WEAPON_SWITCHBLADE"))] = "WT_SWBLADE",
    [tostring(GetHashKey("WEAPON_REVOLVER"))] = "WT_REVOLVER",
    [tostring(GetHashKey("WEAPON_FIRE"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_HELI_CRASH"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_RUN_OVER_BY_CAR"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_HIT_BY_WATER_CANNON"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_EXHAUSTION"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_FALL"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_EXPLOSION"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_BLEEDING"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_DROWNING_IN_VEHICLE"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_DROWNING"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_BARBED_WIRE"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_VEHICLE_ROCKET"))] = "WT_INVALID",
}
function GET_WEAPON_LABEL(hash)
    if(type(hash) ~= "string") then
        hash = tostring(hash)
    end

    local label = WEAPON_HASH_TO_LABEL[hash]
    if label ~= nil then
        return label
    end

    Citizen.Trace("Error reversing weapon hash \"" .. hash .. "\". Maybe it's not been added yet?")
    return "WT_INVALID" -- Return the invalid label
end
Example usage of the above file
-- THIS IS AN EXAMPLE SCRIPT TO SHOW THE USAGE OF THE REVERSE WEAPON FILE

local equippedLabel = "collision_o4mlk9" -- "~a~ equipped"

function showWeaponText(weaponLabel)
    BeginTextCommandDisplayHelp(equippedLabel)

    AddTextComponentSubstringTextLabel(weaponLabel)

    EndTextCommandDisplayHelp(0, 0, 1, -1)
end

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)

        -- Get the current weapon
        local weapHash = GetSelectedPedWeapon(PlayerPedId()) -- https://runtime.fivem.net/doc/reference.html#_0x0A6DB4965674D243

        -- Get the weapon's HumanNameHash (look it up)
        local labelName = GET_WEAPON_LABEL(weapHash)
        -- Display it
        showWeaponText(labelName)
    end
end)

Using labels from other files (not in the global.gxt2)

Credit to @Flatracer for the information below :slight_smile:

For some labels, an additional text has to be requested & loaded.

For example, if I want to use any label from the mod_mnu.gxt2 I have to request it.
But before I check if the slot is free and if the additional text isn’t already loaded in the slot.

local CAT = 'mod_mnu'
local CurrentSlot = 0
while HasAdditionalTextLoaded(CurrentSlot) and not HasThisAdditionalTextLoaded(CAT, CurrentSlot) do
	Citizen.Wait(0)
	CurrentSlot = CurrentSlot + 1
end

If my additional text isn’t already loaded into this slot, I will clear it and load my additional text into it.

if not HasThisAdditionalTextLoaded(CAT, CurrentSlot) then
	ClearAdditionalText(CurrentSlot, true)
	RequestAdditionalText(CAT, CurrentSlot)
	while not HasThisAdditionalTextLoaded(CAT, CurrentSlot) do
		Citizen.Wait(0)
	end
end

That’s it, now I am able to use the labels inside mod_mnu.gxt2


#2

I guess this means i should use labels now? :c


#3

Dam that’s a long tutorial, really nice though! Good job :mascot:


#4

Yea, I was going to do the scaleforms tutorial but someone cough IllusiveTea cough beat me to it so, I thought I’d do labels instead :stuck_out_tongue:


#5

Weapon labels

Someone asked me if there was a way to get a weapon’s display name. Unfortunately there’s no native that can do this so, I’ve written a script that you can use to get the label for a weapon.

This is not a complete list and, there’s probably weapons that show as “Invalid” (as they haven’t been added).

You can view the file (and an example script to showcase how to use it) at the Gist link below.

Example output:
32PM50PM12PM29PM


#7

Edit 2: @Havoc You can add them now, if you want. It should be working :slight_smile:
Edit: Seems like I made some mistakes, wait before adding them.

I expanded the list a bit.

I will do some more testing sometime the next time and will maybe add more…

Now, you can use them
local WEAPON_HASH_TO_LABEL = {
    [tostring(GetHashKey("WEAPON_UNARMED"))] = "WT_UNARMED",
    [tostring(GetHashKey("WEAPON_ANIMAL"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_COUGAR"))] = "WT_RAGE",
    [tostring(GetHashKey("WEAPON_KNIFE"))] = "WT_KNIFE",
    [tostring(GetHashKey("WEAPON_NIGHTSTICK"))] = "WT_NGTSTK",
    [tostring(GetHashKey("WEAPON_HAMMER"))] = "WT_HAMMER",
    [tostring(GetHashKey("WEAPON_BAT"))] = "WT_BAT",
    [tostring(GetHashKey("WEAPON_GOLFCLUB"))] = "WT_GOLFCLUB",
    [tostring(GetHashKey("WEAPON_CROWBAR"))] = "WT_CROWBAR",
    [tostring(GetHashKey("WEAPON_PISTOL"))] = "WT_PIST",
    [tostring(GetHashKey("WEAPON_COMBATPISTOL"))] = "WT_PIST_CBT",
    [tostring(GetHashKey("WEAPON_APPISTOL"))] = "WT_PIST_AP",
    [tostring(GetHashKey("WEAPON_PISTOL50"))] = "WT_PIST_50",
    [tostring(GetHashKey("WEAPON_MICROSMG"))] = "WT_SMG_MCR",
    [tostring(GetHashKey("WEAPON_SMG"))] = "WT_SMG",
    [tostring(GetHashKey("WEAPON_ASSAULTSMG"))] = "WT_SMG_ASL",
    [tostring(GetHashKey("WEAPON_ASSAULTRIFLE"))] = "WT_RIFLE_ASL",
    [tostring(GetHashKey("WEAPON_CARBINERIFLE"))] = "WT_RIFLE_CBN",
    [tostring(GetHashKey("WEAPON_ADVANCEDRIFLE"))] = "WT_RIFLE_ADV",
    [tostring(GetHashKey("WEAPON_MG"))] = "WT_MG",
    [tostring(GetHashKey("WEAPON_COMBATMG"))] = "WT_MG_CBT",
    [tostring(GetHashKey("WEAPON_PUMPSHOTGUN"))] = "WT_SG_PMP",
    [tostring(GetHashKey("WEAPON_SAWNOFFSHOTGUN"))] = "WT_SG_SOF",
    [tostring(GetHashKey("WEAPON_ASSAULTSHOTGUN"))] = "WT_SG_ASL",
    [tostring(GetHashKey("WEAPON_BULLPUPSHOTGUN"))] = "WT_SG_BLP",
    [tostring(GetHashKey("WEAPON_STUNGUN"))] = "WT_STUN",
    [tostring(GetHashKey("WEAPON_SNIPERRIFLE"))] = "WT_SNIP_RIF",
    [tostring(GetHashKey("WEAPON_HEAVYSNIPER"))] = "WT_SNIP_HVY",
    [tostring(GetHashKey("WEAPON_REMOTESNIPER"))] = "WT_SNIP_RMT",
    [tostring(GetHashKey("WEAPON_GRENADELAUNCHER"))] = "WT_GL",
    [tostring(GetHashKey("WEAPON_GRENADELAUNCHER_SMOKE"))] = "WT_GL_SMOKE",
    [tostring(GetHashKey("WEAPON_RPG"))] = "WT_RPG",
    [tostring(GetHashKey("WEAPON_PASSENGER_ROCKET"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_AIRSTRIKE_ROCKET"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_STINGER"))] = "WT_RPG",
    [tostring(GetHashKey("WEAPON_MINIGUN"))] = "WT_MINIGUN",
    [tostring(GetHashKey("WEAPON_GRENADE"))] = "WT_GNADE",
    [tostring(GetHashKey("WEAPON_STICKYBOMB"))] = "WT_GNADE_STK",
    [tostring(GetHashKey("WEAPON_SMOKEGRENADE"))] = "WT_GNADE_SMK",
    [tostring(GetHashKey("WEAPON_BZGAS"))] = "WT_BZGAS",
    [tostring(GetHashKey("WEAPON_MOLOTOV"))] = "WT_MOLOTOV",
    [tostring(GetHashKey("WEAPON_FIREEXTINGUISHER"))] = "WT_FIRE",
    [tostring(GetHashKey("WEAPON_PETROLCAN"))] = "WT_PETROL",
    [tostring(GetHashKey("WEAPON_DIGISCANNER"))] = "WT_DIGI",
    [tostring(GetHashKey("GADGET_NIGHTVISION"))] = "WT_NV",
    [tostring(GetHashKey("GADGET_PARACHUTE"))] = "WT_PARA",
    [tostring(GetHashKey("OBJECT"))] = "WT_OBJECT",
    [tostring(GetHashKey("WEAPON_BRIEFCASE"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_BRIEFCASE_02"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_BALL"))] = "WT_BALL",
    [tostring(GetHashKey("WEAPON_FLARE"))] = "WT_FLARE",
    [tostring(GetHashKey("WEAPON_ELECTRIC_FENCE"))] = "WT_ELCFEN",
    [tostring(GetHashKey("VEHICLE_WEAPON_TANK"))] = "WT_V_TANK",
    [tostring(GetHashKey("VEHICLE_WEAPON_SPACE_ROCKET"))] = "WT_V_SPACERKT",
    [tostring(GetHashKey("VEHICLE_WEAPON_PLAYER_LASER"))] = "WT_V_PLRLSR",
    [tostring(GetHashKey("AMMO_RPG"))] = "WT_A_RPG",
    [tostring(GetHashKey("AMMO_TANK"))] = "WT_A_TANK",
    [tostring(GetHashKey("AMMO_SPACE_ROCKET"))] = "WT_A_SPACERKT",
    [tostring(GetHashKey("AMMO_PLAYER_LASER"))] = "WT_A_PLRLSR",
    [tostring(GetHashKey("AMMO_ENEMY_LASER"))] = "WT_A_ENMYLSR",
    [tostring(GetHashKey("WEAPON_RAMMED_BY_CAR"))] = "WT_PIST",
    [tostring(GetHashKey("WEAPON_BOTTLE"))] = "WT_BOTTLE",
    [tostring(GetHashKey("WEAPON_GUSENBERG"))] = "WT_GUSENBERG",
    [tostring(GetHashKey("WEAPON_SNSPISTOL"))] = "WT_SNSPISTOL",
    [tostring(GetHashKey("WEAPON_VINTAGEPISTOL"))] = "WT_VPISTOL",
    [tostring(GetHashKey("WEAPON_DAGGER"))] = "WT_DAGGER",
    [tostring(GetHashKey("WEAPON_FLAREGUN"))] = "WT_FLAREGUN",
    [tostring(GetHashKey("WEAPON_HEAVYPISTOL"))] = "WT_HEAVYPSTL",
    [tostring(GetHashKey("WEAPON_SPECIALCARBINE"))] = "WT_RIFLE_SCBN",
    [tostring(GetHashKey("WEAPON_MUSKET"))] = "WT_MUSKET",
    [tostring(GetHashKey("WEAPON_FIREWORK"))] = "WT_FWRKLNCHR",
    [tostring(GetHashKey("WEAPON_MARKSMANRIFLE"))] = "WT_MKRIFLE",
    [tostring(GetHashKey("WEAPON_HEAVYSHOTGUN"))] = "WT_HVYSHOT",
    [tostring(GetHashKey("WEAPON_PROXMINE"))] = "WT_PRXMINE",
    [tostring(GetHashKey("WEAPON_HOMINGLAUNCHER"))] = "WT_HOMLNCH",
    [tostring(GetHashKey("WEAPON_HATCHET"))] = "WT_HATCHET",
    [tostring(GetHashKey("WEAPON_COMBATPDW"))] = "WT_COMBATPDW",
    [tostring(GetHashKey("WEAPON_KNUCKLE"))] = "WT_KNUCKLE",
    [tostring(GetHashKey("WEAPON_MARKSMANPISTOL"))] = "WT_MKPISTOL",
    [tostring(GetHashKey("WEAPON_MACHETE"))] = "WT_MACHETE",
    [tostring(GetHashKey("WEAPON_MACHINEPISTOL"))] = "WT_MCHPIST",
    [tostring(GetHashKey("WEAPON_FLASHLIGHT"))] = "WT_FLASHLIGHT",
    [tostring(GetHashKey("WEAPON_DBSHOTGUN"))] = "WT_DBSHGN",
    [tostring(GetHashKey("WEAPON_COMPACTRIFLE"))] = "WT_CMPRIFLE",
    [tostring(GetHashKey("WEAPON_SWITCHBLADE"))] = "WT_SWBLADE",
    [tostring(GetHashKey("WEAPON_REVOLVER"))] = "WT_REVOLVER",
    [tostring(GetHashKey("WEAPON_FIRE"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_HELI_CRASH"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_RUN_OVER_BY_CAR"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_HIT_BY_WATER_CANNON"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_EXHAUSTION"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_FALL"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_EXPLOSION"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_BLEEDING"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_DROWNING_IN_VEHICLE"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_DROWNING"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_BARBED_WIRE"))] = "WT_INVALID",
    [tostring(GetHashKey("WEAPON_VEHICLE_ROCKET"))] = "WT_INVALID",
}

#8

You may add to your tutorial, that for some labels, an additional text has to be requested & loaded.

For example, if I want to use any label from the mod_mnu.gxt2 I have to request it.
But before I check if the slot is free and if the additional text isn’t already loaded in the slot.

local CAT = 'mod_mnu'
local CurrentSlot = 0
while HasAdditionalTextLoaded(CurrentSlot) and not HasThisAdditionalTextLoaded(CAT, CurrentSlot) do
	Citizen.Wait(0)
	CurrentSlot = CurrentSlot + 1
end

If my additional text isn’t already loaded into this slot, I will clear it and load my additional text into it.

if not HasThisAdditionalTextLoaded(CAT, CurrentSlot) then
	ClearAdditionalText(CurrentSlot, true)
	RequestAdditionalText(CAT, CurrentSlot)
	while not HasThisAdditionalTextLoaded(CAT, CurrentSlot) do
		Citizen.Wait(0)
	end
end

Thats it, now I am able to use the labels inside mod_mnu.gxt2


#9

Cheers :smiley:

I’ve turned the original post into a Wiki so, you should be able to just edit that and add any new labels you find or, any more information (and, others can clarify stuff if they wish).