hi guys i have problem with gate script. It worked before but now it seems doesnt work.
error https://prnt.sc/fcufup
--create the gate (DO NOT EDIT)
local ggate = createObject ( GateObject, Defx, Defy, defz, rotX, rotY, rotZ)
--DO NOT EDIT
function gateopen ( p )
if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(p)), aclGetGroup(ACL)) then
moveObject (ggate, OpenTime, opx, opy, opz)
outputChatBox("Admin base gate opened", p,0,255,0,true)
else
outputChatBox("Sorry you dont have permission to do that!", p,0,255,0,true)
end
end
addCommandHandler( opencommand, gateopen)
function gateclose ( p )
if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(p)), aclGetGroup(ACL)) then
moveObject (ggate, OpenTime, Defx, Defy, defz)
outputChatBox("Admin base gate closed", p,0,255,0,true)
else
outputChatBox("Sorry you dont have permission to do that!", p,0,255,0,true)
end
end
addCommandHandler( closecommand, gateclose)
function handlerFunction(thePlayer)
local oX, oY, oZ = getElementPosition(ggate)
if math.floor(oZ) == math.floor(defz) then
gateopen(thePlayer)
elseif math.floor(oZ) == math.floor(opz) then
gateclose(thePlayer)
end
end
addEventHandler("onResourceStart", getResourceRootElement(), function()
for i, k in ipairs(getElementsByType("player")) do
bindKey(k, "K", "down", handlerFunction)
end
end)
addEventHandler("onPlayerJoin", getRootElement(), function()
bindKey(source, "K", "down", handlerFunction)
end)