Using Labels!

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

1 Like

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).

1 Like

Very nice tutorial thank you!
People might also be interested in this list containing all labels in the game as of the latest version (1365), compiled by UnknownModder from the GTAF. I find it easier to look for a certain label with a simple ctrl+F in that document.

2 Likes

Would it be a good idea to mention the use of AddTextEntry so we can finally get rid of the abuse of STRING? :stuck_out_tongue:

2 Likes

it definitely would :smile:

:neutral_face:


kek

BeginTextCommandDisplayHelp("STRING")
AddTextComponentSubstringTextLabelHashKey(0x03F99BEA)
EndTextCommandDisplayHelp(0, 0, 1, -1)

image

why use that ugly thing? you could also just do this:

AddTextEntry("SOMETHING_SOMETHING", "Upload  Complete")
BeginTextCommandDisplayHelp("SOMETHING_SOMETHING")
EndTextCommandDisplayHelp(0, 0, 1, -1)
1 Like

sorry for asking this… if i release a script with random collisions added as labels_texts… do other people read it correctly? or it is only something for me?

I am having a problem with these kind of labels. It is not UTF-8 and missing some letters in my language. Is there a way to modify this? The missing letters are from Windows-1257 or ISO/IEC 8859-13

1 Like

Question. Not sure if this is an issue on my end. But I am using RP Revive in my server. I am trying to replace the old notification with this, but I am running into an issue.

When I die in game, I hear the tone of the label popping up, but nothing shows on screen.

Here’s my current code:

    while true do
    Citizen.Wait(0)
		ped = GetPlayerPed(-1)
		if IsEntityDead(ped) then
			-- ShowInfoRevive('~r~You Are Dead ~w~Please wait ~y~'.. tostring(reviveWait) ..' Seconds ~w~ before choosing an action')

            SetPlayerInvincible(ped, true)
            SetEntityHealth(ped, 1)

			ShowInfoRevive()

			if ( IsControlJustReleased( 0, 38 ) or IsDisabledControlJustReleased( 0, 38 ) ) and GetLastInputMethod( 0 ) then 
					revivePed(ped)
					
            elseif ( IsControlJustReleased( 0, 65 ) or IsDisabledControlJustReleased( 0, 65 ) ) and GetLastInputMethod( 0 ) then
                local coords = spawnPoints[math.random(1,#spawnPoints)]

				respawnPed(ped, coords)

				allowRespawn = false
				respawnCount = respawnCount + 1
				math.randomseed( playerIndex * respawnCount )
            end
        end
    end
end)

function revivePed(ped)
	local playerPos = GetEntityCoords(ped, true)

	NetworkResurrectLocalPlayer(playerPos, true, true, false)
	SetPlayerInvincible(ped, false)
	ClearPedBloodDamage(ped)
end

function ShowInfoRevive()
	BeginTextCommandDisplayHelp("STRING")
	AddTextComponentSubstringPlayerName("~r~You have died! ~w~Use ~INPUT_PICKUP~ to revive.")
	AddTextComponentFloat(100.3948, 2)
	EndTextCommandDisplayHelp(0, 0, 1, -1)
end

Hope someone can help. Thanks in advance!

is there anyway to use UTF8 in this kind of texts ?

Add a custom font with UTF-8 Support?

1 Like

i added but it won’t load well !
image
it should be سلام دنیا

Which font is that?

IranSans (Persian)
Arabic or Persian font can do my job

1 Like

That is caused by the font

Check there for a font which does what you need.

Since your original question is answered, please create your own topic if you still need assistance.
@MrAjax

1 Like

The list of all text labels is not accessible anymore. You can use: https://gist.github.com/alloc8or/057e4d573cdfe238db31ec5edf2efbbb/ (thanks to Jaymo for linking me this one).

Updated the original post with the updated link :smiley:

1 Like