From 67b2be90069e12c9683066e140fabad06f7a5ac8 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 28 May 2021 12:48:37 +1000 Subject: [PATCH] fix(client/functions): Fixed the distance scaling for DrawRect; added rect as an option DrawRect was only added in the last month so this shouldn't affect anyone --- client/functions.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/functions.lua b/client/functions.lua index c13ae23d..e8479cc5 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -706,7 +706,7 @@ ESX.Game.SetVehicleProperties = function(vehicle, props) end end -ESX.Game.Utils.DrawText3D = function(coords, text, size, font) +ESX.Game.Utils.DrawText3D = function(coords, text, size, font, rect) local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z) local camCoords = GetGameplayCamCoords() @@ -728,9 +728,10 @@ ESX.Game.Utils.DrawText3D = function(coords, text, size, font) AddTextComponentString(text) SetDrawOrigin(vector.xyz, 0) DrawText(0.0, 0.0) - local scaleFactor = scale * fov - local length = string.len(string.gsub(text, "(~[rbgypcmuosh]~)", "")) - DrawRect(0.0, 0.0 + 0.0111 * scaleFactor, 0.027 + (length / 260) * scaleFactor, 0.03 * scaleFactor, 0, 0, 0, 75) + if rect then + local length = string.len(text:gsub('~.-~', ''))/13.5 + DrawRect(0.0, 0.18 / distance, length / distance, 0.04 * scale , 0,0,0, 75) + end ClearDrawOrigin() end