From 989f033df852b7bcb701ddefabc8d59a2768fef2 Mon Sep 17 00:00:00 2001 From: Niek <32094562+niekschoemaker@users.noreply.github.com> Date: Thu, 10 Aug 2023 18:22:58 +0200 Subject: [PATCH 1/5] Update BeginTextCommandDisplayText.md --- HUD/BeginTextCommandDisplayText.md | 32 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/HUD/BeginTextCommandDisplayText.md b/HUD/BeginTextCommandDisplayText.md index f2f0fda82..45a7e711b 100644 --- a/HUD/BeginTextCommandDisplayText.md +++ b/HUD/BeginTextCommandDisplayText.md @@ -9,14 +9,30 @@ 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 -``` +Begin a new Text Command. +Add the needed components with [ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME](#_0x6C188BE134E074AA) (and other ADD_TEXT_COMPONENT natives) + +To add a custom text entry see [ADD_TEXT_ENTRY](#_0x32CA01C3) ## 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) +BegintTextCommandDisplayText("HELLO_WORLD") +EndTextCommandDisplayText(0.3, 0.3) + +-- Display text with substring +SetTextFont(0) +SetTextScale(0.0, 0.30) +BegintTextCommandDisplayText("STRING") +AddTextComponentSubstringPlayerName("Hello World") +EndTextCommandDisplayText(0.3, 0.3) +``` From 1569d8c784b151922c011597c00f9da221e6992a Mon Sep 17 00:00:00 2001 From: Niek <32094562+niekschoemaker@users.noreply.github.com> Date: Thu, 10 Aug 2023 18:36:03 +0200 Subject: [PATCH 2/5] Update BeginTextCommandDisplayText.md --- HUD/BeginTextCommandDisplayText.md | 1 + 1 file changed, 1 insertion(+) diff --git a/HUD/BeginTextCommandDisplayText.md b/HUD/BeginTextCommandDisplayText.md index 45a7e711b..18f9e88c9 100644 --- a/HUD/BeginTextCommandDisplayText.md +++ b/HUD/BeginTextCommandDisplayText.md @@ -11,6 +11,7 @@ void BEGIN_TEXT_COMMAND_DISPLAY_TEXT(char* text); 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) From 9ef853cf0e709fc72201cb30ffe54d35609a9779 Mon Sep 17 00:00:00 2001 From: Niek Schoemaker <32094562+niekschoemaker@users.noreply.github.com> Date: Fri, 13 Oct 2023 14:28:11 +0200 Subject: [PATCH 3/5] Add example labels to _GET_LABEL_TEXT refer to _GET_LABEL_TEXT from BEGINT_TEXT_COMMAND_DISPLAY_TEXT --- HUD/BeginTextCommandDisplayText.md | 2 + HUD/GetLabelText.md | 61 ++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/HUD/BeginTextCommandDisplayText.md b/HUD/BeginTextCommandDisplayText.md index 18f9e88c9..9a14d22e2 100644 --- a/HUD/BeginTextCommandDisplayText.md +++ b/HUD/BeginTextCommandDisplayText.md @@ -15,6 +15,8 @@ The Text components here refer to placeholders, see [content-formatting-codes](h To add a custom text entry see [ADD_TEXT_ENTRY](#_0x32CA01C3) +For some example label names see [_GET_LABEL_TEXT](?_0x7B5280EBA9840C72). + ## Parameters * **text**: The gxtEntry to use diff --git a/HUD/GetLabelText.md b/HUD/GetLabelText.md index 05f997ad7..a27248abf 100644 --- a/HUD/GetLabelText.md +++ b/HUD/GetLabelText.md @@ -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 + +``` \ No newline at end of file From 6acc2e8c4f00ba9152b4ee9c3474662aee2e781d Mon Sep 17 00:00:00 2001 From: Niek <32094562+niekschoemaker@users.noreply.github.com> Date: Tue, 17 Oct 2023 14:19:17 +0200 Subject: [PATCH 4/5] Update BeginTextCommandDisplayText.md --- HUD/BeginTextCommandDisplayText.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HUD/BeginTextCommandDisplayText.md b/HUD/BeginTextCommandDisplayText.md index 9a14d22e2..59ec488b1 100644 --- a/HUD/BeginTextCommandDisplayText.md +++ b/HUD/BeginTextCommandDisplayText.md @@ -29,13 +29,13 @@ AddTextEntry("HELLO_WORLD", "Hello World") SetTextFont(0) SetTextScale(0.0, 0.30) -BegintTextCommandDisplayText("HELLO_WORLD") +BeginTextCommandDisplayText("HELLO_WORLD") EndTextCommandDisplayText(0.3, 0.3) -- Display text with substring SetTextFont(0) SetTextScale(0.0, 0.30) -BegintTextCommandDisplayText("STRING") +BeginTextCommandDisplayText("STRING") AddTextComponentSubstringPlayerName("Hello World") EndTextCommandDisplayText(0.3, 0.3) ``` From a5ee17a0b582be304c5594e251edb0dc6fd059a4 Mon Sep 17 00:00:00 2001 From: Dillon Skaggs Date: Wed, 7 Aug 2024 13:25:20 -0500 Subject: [PATCH 5/5] Update HUD/BeginTextCommandDisplayText.md --- HUD/BeginTextCommandDisplayText.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HUD/BeginTextCommandDisplayText.md b/HUD/BeginTextCommandDisplayText.md index 59ec488b1..4a0a162b4 100644 --- a/HUD/BeginTextCommandDisplayText.md +++ b/HUD/BeginTextCommandDisplayText.md @@ -15,7 +15,7 @@ The Text components here refer to placeholders, see [content-formatting-codes](h To add a custom text entry see [ADD_TEXT_ENTRY](#_0x32CA01C3) -For some example label names see [_GET_LABEL_TEXT](?_0x7B5280EBA9840C72). +For some example label names see [_GET_LABEL_TEXT](#_0x7B5280EBA9840C72). ## Parameters * **text**: The gxtEntry to use