Skip to content

Commit 3af15bc

Browse files
authored
fix(security): validate teleport permissions (#8)
1 parent 1b83c88 commit 3af15bc

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

client/utils.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,7 @@ end)
219219
RegisterNUICallback('teleportToDoor', function(id, cb)
220220
cb(1)
221221
SetNuiFocus(false, false)
222-
local doorCoords = doors[id].coords
223-
if not doorCoords then return end
224-
SetEntityCoords(cache.ped, doorCoords.x, doorCoords.y, doorCoords.z, false, false, false, false)
222+
TriggerServerEvent('ox_doorlock:teleportToDoor', id)
225223
end)
226224

227225
RegisterNUICallback('exit', function(_, cb)

server/main.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,20 @@ RegisterNetEvent('ox_doorlock:breakLockpick', function()
345345
return player and DoesPlayerHaveItem(player, Config.LockpickItems, true)
346346
end)
347347

348+
RegisterNetEvent('ox_doorlock:teleportToDoor', function(id)
349+
if not IsPlayerAceAllowed(source, 'command.doorlock') then
350+
return
351+
end
352+
353+
local door = doors[id]
354+
if not door or not door.coords then
355+
return
356+
end
357+
358+
local ped = GetPlayerPed(source)
359+
SetEntityCoords(ped, door.coords.x, door.coords.y, door.coords.z, false, false, false, false)
360+
end)
361+
348362
lib.addCommand('doorlock', {
349363
help = locale('create_modify_lock'),
350364
params = {

0 commit comments

Comments
 (0)