Jump to content

need help with script


Actimel

Recommended Posts

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)

 

Edited by Actimel
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...