Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 5 additions & 2 deletions cl_render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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~)',
Expand Down Expand Up @@ -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,
}