From d8bd36b2ed34748d0579cfc703437840579d4494 Mon Sep 17 00:00:00 2001 From: SMVampire Date: Mon, 17 May 2021 12:46:26 -0400 Subject: [PATCH 1/2] fix(3DText): Force Scale Float Some older resources used scale as a number. Scale _must_ be a float. This forces scale to be a float if it exists. --- client/functions.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/client/functions.lua b/client/functions.lua index 24b1fb7f..171aebd9 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -699,6 +699,7 @@ end ESX.Game.Utils.DrawText3D = function(coords, text, scale, font) local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z) + if scale then scale = scale + 0.0 end if not scale then scale = 0.35 end if not font then font = 4 end From 76502fb16c1b1b2d1a2c51a0af093c3c6e6304fa Mon Sep 17 00:00:00 2001 From: DokaDoka Date: Wed, 19 May 2021 00:58:51 +1000 Subject: [PATCH 2/2] fix(legacy/Text3D): Remove formatting characters from length calc --- client/functions.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/functions.lua b/client/functions.lua index 171aebd9..72d251ee 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -714,7 +714,8 @@ ESX.Game.Utils.DrawText3D = function(coords, text, scale, font) SetDrawOrigin(vector.xyz, 0) DrawText(0.0, 0.0) local scaleFactor = scale / 0.35 - DrawRect(0.0, 0.0 + 0.0111 * scaleFactor, 0.017 + (string.len(text) / 370) * scaleFactor, 0.03 * scaleFactor, 0, 0, 0, 75) + local length = string.len(string.gsub(text, "(~[rbgypcmuosh]~)", "")) + DrawRect(0.0, 0.0 + 0.0111 * scaleFactor, 0.027 + (length / 370) * scaleFactor, 0.03 * scaleFactor, 0, 0, 0, 75) ClearDrawOrigin() end