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
1 change: 1 addition & 0 deletions cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ nearest = nil
pBlip = nil

exports('getPostal', function() return nearest and nearest.code or nil end)
exports('setDirections', function(postal) SetRouteToPostal(postal) end)
16 changes: 10 additions & 6 deletions cl_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ local format = string.format
--- [[ Nearest Postal Commands ]] ---
---

TriggerEvent('chat:addSuggestion', '/postal', 'Set the GPS to a specific postal',
{ { name = 'Postal Code', help = 'The postal code you would like to go to' } })

RegisterCommand('postal', function(_, args)
if #args < 1 then
function SetRouteToPostal(postal)
if not postal then
if pBlip then
RemoveBlip(pBlip.hndl)
pBlip = nil
Expand All @@ -27,7 +24,7 @@ RegisterCommand('postal', function(_, args)
return
end

local userPostal = upper(args[1])
local userPostal = upper(postal)
local foundPostal

for _, p in ipairs(postals) do
Expand Down Expand Up @@ -65,5 +62,12 @@ RegisterCommand('postal', function(_, args)
}
})
end
end

TriggerEvent('chat:addSuggestion', '/postal', 'Set the GPS to a specific postal',
{ { name = 'Postal Code', help = 'The postal code you would like to go to' } })

RegisterCommand('postal', function(_, args)
SetRouteToPostal(args[1])
end)