Door3 = createObject(980,-2396.599609375,-6944.599609375,9.5,0,0,90)
markerDoor3 = createMarker(-2396.599609375,-6944.599609375,9.5,'cylinder',7,0,0,0,0
aGroups = {
"GroupName",
"GroupName",
"Admin",
"GroupName",
}
function check(plr)
for i,k in ipairs (aGroups) do
if getElementData (plr,"Group") == tostring(k) then
return true
end
end
return false
end
function dtc(plr)
if isElementWithinMarker (plr,markerDoor3) then
local x,y,z = getElementPosition (Door3)
if check(plr) then
if tonumber(z) <= 15.10000038147 then
moveObject(Door3,1000,-2396.599609375,-6944.599609375,19.5)
else
moveObject (Door3,1000,-2396.599609375,-6944.599609375,19.5)
end
else
outputChatBox("Access denied",plr,255,0,0)
end
end
end
function Bind()
if eventName == "onResourceStart" then
for i,v in ipairs (getElementsByType("player")) do
bindKey (v,"tab","down",dtc)
end
else
bindKey (source,"tab","down",dtc)
end
end
addEventHandler ("onResourceStart",resourceRoot,Bind)
addEventHandler ("onPlayerJoin",root,Bind)