Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BeginTextCommandDisplayText.md #907

Closed
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions HUD/BeginTextCommandDisplayText.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,33 @@ aliases: ["_SET_TEXT_ENTRY"]
void BEGIN_TEXT_COMMAND_DISPLAY_TEXT(char* text);
```

```
The following were found in the decompiled script files:
STRING, TWOSTRINGS, NUMBER, PERCENTAGE, FO_TWO_NUM, ESMINDOLLA, ESDOLLA, MTPHPER_XPNO, AHD_DIST, CMOD_STAT_0, CMOD_STAT_1, CMOD_STAT_2, CMOD_STAT_3, DFLT_MNU_OPT, F3A_TRAFDEST, ES_HELP_SOC3
ESDOLLA
ESMINDOLLA - cash (negative)
Used to be known as _SET_TEXT_ENTRY
AvarianKnight marked this conversation as resolved.
Show resolved Hide resolved
```
Begin a new Text Command.
Add the needed components with [ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME](#_0x6C188BE134E074AA) (and other ADD_TEXT_COMPONENT natives)
The Text components here refer to placeholders, see [content-formatting-codes](https://docs.fivem.net/docs/game-references/text-formatting/#content-formatting-codes)

To add a custom text entry see [ADD_TEXT_ENTRY](#_0x32CA01C3)

For some example label names see [_GET_LABEL_TEXT](?_0x7B5280EBA9840C72).
AvarianKnight marked this conversation as resolved.
Show resolved Hide resolved

## Parameters
* **text**:
* **text**: The gxtEntry to use


## Examples

```lua
-- Display text with Text Entry
AddTextEntry("HELLO_WORLD", "Hello World")

SetTextFont(0)
SetTextScale(0.0, 0.30)
BeginTextCommandDisplayText("HELLO_WORLD")
EndTextCommandDisplayText(0.3, 0.3)

-- Display text with substring
SetTextFont(0)
SetTextScale(0.0, 0.30)
BeginTextCommandDisplayText("STRING")
AddTextComponentSubstringPlayerName("Hello World")
EndTextCommandDisplayText(0.3, 0.3)
```
61 changes: 57 additions & 4 deletions HUD/GetLabelText.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,65 @@ ns: HUD
char* _GET_LABEL_TEXT(char* labelName);
```

```
Gets a string literal from a label name.
GET_F*
```

Most useful application for this is getting vehicle labels from result of [GET_DISPLAY_NAME_FROM_VEHICLE_MODEL](#_0xB215AAC32D25D019)

For a full list of built-in labels search for **global.gxt2** in GTA Files.

To add a custom text entry see [ADD_TEXT_ENTRY](#_0x32CA01C3)

Some example label names are:

STRING, TWOSTRINGS, NUMBER, PERCENTAGE, FO_TWO_NUM, ESMINDOLLA, ESDOLLA, MTPHPER_XPNO, AHD_DIST, CMOD_STAT_0, CMOD_STAT_1, CMOD_STAT_2, CMOD_STAT_3, DFLT_MNU_OPT, F3A_TRAFDEST, ES_HELP_SOC3

## Parameters
* **labelName**:
* **labelName**: The label name to get the text/label from

## Return value

The label text, or "NULL" (not nil, but string literal NULL) if not found

## Examples

```lua
local label = GetLabelText("STRING")

print(label) -- ~a~

local label = GetLabelText("ESDOLLA")

print(label) -- $~a~

local label = GetLabelText("ESMINDOLLA")

print(label) -- -$~a~

local label = GetLabelText("DFLT_MNU_OPT")

print(label) -- Exit

-- Non existent label
local label = GetLabelText("this_label_doesnt_exist")

print(label) -- NULL

local model = `baller`
local displayName = GetDisplayNameFromVehicleModel(model)
local vehicleLabel = GetLabelText(displayName)

if vehicleLabel == "NULL" then
print(vehicleLabel) -- Baller
else
-- Label not found, use displayName instead
print(displayName) -- BALLER
vehicleLabel = displayName
end

local makeName = GetMakeNameFromVehicleModel(model)
local makeLabel = GetLabelText(makeName)
if makeLabel ~= "NULL" then
print(("%s %s"):format(makeLabel, vehicleLabel)) -- Gallivanter Baller
end

```
Loading