1
0
Fork 0
forked from Simnation/Main
Main/resources/[tools]/nearest-postal-1.5.3/cl.lua

23 lines
664 B
Lua
Raw Normal View History

2025-07-18 20:21:42 +02:00
---@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)