diff --git a/cl.lua b/cl.lua index c5296d2..d93366a 100644 --- a/cl.lua +++ b/cl.lua @@ -20,3 +20,5 @@ nearest = nil pBlip = nil exports('getPostal', function() return nearest and nearest.code or nil end) +exports('getDistance', function() return nearest and nearest.dist or nil end) +exports('getNearest', function() return nearest end) diff --git a/cl_render.lua b/cl_render.lua index 5f57cdd..e590f7c 100644 --- a/cl_render.lua +++ b/cl_render.lua @@ -22,8 +22,8 @@ Citizen.CreateThread(function() while postals == nil do Wait(1) end local delay = math.max(config.updateDelay and tonumber(config.updateDelay) or 300, 50) - if not delay or tonumber(delay) <= 0 then - error("Invalid render delay provided, it must be a number > 0") + if not delay or tonumber(delay) < 50 then + error("Invalid render delay provided, it must be a number > 50") end local postals = postals @@ -65,6 +65,9 @@ end) -- text display thread Citizen.CreateThread(function() + if config.text.display == false then + return + end local posX = config.text.posX local posY = config.text.posY local _string = "STRING" diff --git a/config.lua b/config.lua index 3974a05..f4b0c88 100644 --- a/config.lua +++ b/config.lua @@ -3,6 +3,8 @@ config = { versionCheck = true, text = { + -- Turn on or off the text display + display = true, -- The text to display on-screen for the nearest postal. -- Formatted using Lua strings, http://www.lua.org/pil/20.html format = '~y~Nearest Postal~w~: %s (~g~%.2fm~w~)', @@ -44,6 +46,7 @@ config = { }, -- How often in milliseconds the postal code is updated on each client. - -- I wouldn't recommend anything lower than 50ms for performance reasons + -- Default: 300 + -- Minimum: 50 updateDelay = nil, }