-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.lua
30 lines (25 loc) · 870 Bytes
/
server.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local function lockdownDoors(doorIds)
for _, doorId in ipairs(doorIds) do
exports.ox_doorlock:setDoorState(doorId, true)
end
end
local function unlockDoors(doorIds)
for _, doorId in ipairs(doorIds) do
exports.ox_doorlock:setDoorState(doorId, false)
end
end
RegisterNetEvent('door_lockdown:lockdown')
AddEventHandler('door_lockdown:lockdown', function(doorIds)
lockdownDoors(doorIds)
end)
RegisterNetEvent('door_lockdown:unlock')
AddEventHandler('door_lockdown:unlock', function(doorIds)
unlockDoors(doorIds)
end)
RegisterNetEvent('door_lockdown:getAllDoors')
AddEventHandler('door_lockdown:getAllDoors', function()
local source = source
exports.oxmysql:execute('SELECT id, name, data FROM ox_doorlock', {}, function(doorlocks)
TriggerClientEvent('door_lockdown:receiveDoors', source, doorlocks)
end)
end)