-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathserver.lua
27 lines (21 loc) · 859 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
ESX = nil -- If you want to use this with ESX
isLocked = nil
doorList = {1,2,3,4,5,6,7,8,9,10,11,12,13}
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) -- If you want to use this with ESX
RegisterServerEvent('door:update')
AddEventHandler('door:update', function(id, isLocked)
if (id ~= nil and isLocked ~= nil) then -- Make sure values got sent
TriggerClientEvent('door:state', -1, id, isLocked)
end
end)
AddEventHandler('esx:playerLoaded', function(source)
local isLocked = true
local id = doorList[i]
TriggerClientEvent('door:state', -1, id, isLocked)
end)
RegisterServerEvent('esx_doors:getDoors')
AddEventHandler('esx_doors:getDoors', function(id, isLocked)
if (id ~= nil and isLocked ~= nil) then -- Make sure values got sent
TriggerClientEvent('door:state', -1, id, isLocked)
end
end)