-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathcl.lua
More file actions
24 lines (21 loc) · 795 Bytes
/
cl.lua
File metadata and controls
24 lines (21 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---@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)
exports('getDistance', function() return nearest and nearest.dist or nil end)
exports('getNearest', function() return nearest end)