forked from DevBlocky/nearest-postal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcl.lua
More file actions
22 lines (19 loc) · 664 Bytes
/
cl.lua
File metadata and controls
22 lines (19 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
---@class PostalData : table<number, vec>
---@field code string
---@type table<number, PostalData>
postals = nil
Citizen.CreateThread(function()
postals = LoadResourceFile(GetCurrentResourceName(), GetResourceMetadata(GetCurrentResourceName(), 'postal_file'))
postals = json.decode(postals)
for i, postal in ipairs(postals) do postals[i] = { vec(postal.x, postal.y), code = postal.code } end
end)
---@class NearestResult
---@field code string
---@field dist number
nearest = nil
---@class PostalBlip
---@field 1 vec
---@field p PostalData
---@field hndl number
pBlip = nil
exports('getPostal', function() return nearest and nearest.code or nil end)