Skip to content

Commit e1919cb

Browse files
committed
Reformat from tabs to spaces
1 parent 3fe0e67 commit e1919cb

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

sv.lua

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
-- version check
22
Citizen.CreateThread(function()
3-
local vRaw = LoadResourceFile(GetCurrentResourceName(), 'version.json')
4-
if vRaw and config.versionCheck then
5-
local v = json.decode(vRaw)
6-
local url = 'https://raw.githubusercontent.com/DevBlocky/nearest-postal/master/version.json'
7-
PerformHttpRequest(url, function(code, res)
8-
if code == 200 then
9-
local rv = json.decode(res)
10-
if rv.version ~= v.version then
11-
print(([[
3+
local vRaw = LoadResourceFile(GetCurrentResourceName(), 'version.json')
4+
if vRaw and config.versionCheck then
5+
local v = json.decode(vRaw)
6+
local url = 'https://raw.githubusercontent.com/DevBlocky/nearest-postal/master/version.json'
7+
PerformHttpRequest(url, function(code, res)
8+
if code == 200 then
9+
local rv = json.decode(res)
10+
if rv.version ~= v.version then
11+
print(([[
1212
-------------------------------------------------------
1313
nearest-postal
1414
UPDATE: %s AVAILABLE
1515
CHANGELOG: %s
1616
-------------------------------------------------------
1717
]]):format(rv.version, rv.changelog))
18-
end
19-
else
20-
print('nearest-postal was unable to check the version')
21-
end
22-
end, 'GET')
23-
end
18+
end
19+
else
20+
print('nearest-postal was unable to check the version')
21+
end
22+
end, 'GET')
23+
end
2424
end)
2525

2626
-- add functionality to get postals server side from a vec3
2727

2828
local postals = nil
2929
Citizen.CreateThread(function()
30-
postals = LoadResourceFile(GetCurrentResourceName(), GetResourceMetadata(GetCurrentResourceName(), 'postal_file'))
31-
postals = json.decode(postals)
32-
for i, postal in ipairs(postals) do
33-
postals[i] = {vec(postal.x, postal.y), code = postal.code}
34-
end
30+
postals = LoadResourceFile(GetCurrentResourceName(), GetResourceMetadata(GetCurrentResourceName(), 'postal_file'))
31+
postals = json.decode(postals)
32+
for i, postal in ipairs(postals) do
33+
postals[i] = {vec(postal.x, postal.y), code = postal.code}
34+
end
3535
end)
3636

3737
local function getPostalServer(coords)
38-
while postals == nil do
39-
Wait(1)
40-
end
41-
local _total = #postals
42-
local _nearestIndex, _nearestD
43-
coords = vec(coords[1], coords[2])
38+
while postals == nil do
39+
Wait(1)
40+
end
41+
local _total = #postals
42+
local _nearestIndex, _nearestD
43+
coords = vec(coords[1], coords[2])
4444

45-
for i = 1, _total do
46-
local D = #(coords - postals[i][1])
47-
if not _nearestD or D < _nearestD then
48-
_nearestIndex = i
49-
_nearestD = D
50-
end
51-
end
52-
local _code = postals[_nearestIndex].code
53-
local nearest = {code = _code, dist = _nearestD}
54-
return nearest or nil
45+
for i = 1, _total do
46+
local D = #(coords - postals[i][1])
47+
if not _nearestD or D < _nearestD then
48+
_nearestIndex = i
49+
_nearestD = D
50+
end
51+
end
52+
local _code = postals[_nearestIndex].code
53+
local nearest = {code = _code, dist = _nearestD}
54+
return nearest or nil
5555
end
5656

5757
exports('getPostalServer', function(coords)
58-
return getPostalServer(coords)
58+
return getPostalServer(coords)
5959
end)

0 commit comments

Comments
 (0)