refactor(client/zoneCreator): restrict command access

Includes fix for zone name.
This commit is contained in:
Linden
2022-09-14 00:56:56 +10:00
parent bac9eb576d
commit 107d812dc3
2 changed files with 4 additions and 4 deletions

View File

@@ -68,7 +68,7 @@ RegisterCommand('zone', function(source, args, rawCommand)
startCreator(args[1]) startCreator(args[1])
end end
end end
end) end, true)
local function closeCreator(cancel) local function closeCreator(cancel)
if not cancel then if not cancel then
@@ -76,7 +76,7 @@ local function closeCreator(cancel)
points[#points + 1] = vec(xCoord, yCoord) points[#points + 1] = vec(xCoord, yCoord)
end end
lib.inputDialog(('Name your %s Zone'):format(firstToUpper(zoneType)), {'Name'}) local name = lib.inputDialog(('Name your %s Zone'):format(firstToUpper(zoneType)), {'Name'})
TriggerServerEvent('ox_lib:saveZone', { TriggerServerEvent('ox_lib:saveZone', {
zoneType = zoneType, zoneType = zoneType,
@@ -94,7 +94,7 @@ local function closeCreator(cancel)
creatorActive = false creatorActive = false
controlsActive = false controlsActive = false
lib.hideTextUI(true) lib.hideTextUI()
zoneType = nil zoneType = nil
end end
@@ -221,7 +221,7 @@ CreateThread(function()
elseif IsDisabledControlJustPressed(0, 22) then -- space elseif IsDisabledControlJustPressed(0, 22) then -- space
change = true change = true
if zoneType == 'poly' then if zoneType == 'poly' then
points[#points + 1] = vec(xCoord, yCoord) points[#points + 1] = vec2(xCoord, yCoord)
end end
local coords = GetEntityCoords(cache.ped) local coords = GetEntityCoords(cache.ped)