hi im trying to open/close gate with just one command,i dont want 2 different commands but this doesnt work
function createTheGate1 ()
myGate1 = createObject ( 7657, 2522.2001953125, -1278, 35.5 )
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate1 )
function openMyGate1 (thePlayer)
local playerTeam = getPlayerTeam(thePlayer)
local teamName = getTeamName(playerTeam)
if (teamName) then
if (teamName) == "Test" then
moveObject ( myGate1, 3000, 2522.1999511719, -1278, 38.900001525879 )
setElementData(myGate1,"gate.state",1)
outputChatBox("Gate has been opened!",thePlayer,0,255,0,true)
elseif getElementData(myGate1,"gate.state" == 1) then
moveObject ( myGate1, 3000,2522.2001953125, -1278, 35.5 )
setElementData(myGate1,"gate.state",0)
outputChatBox("Gate has been closed!",thePlayer,255,0,0,true)
else
outputChatBox("You don't have access to open the gate!",thePlayer,255,0,0,true)
end
end
end
addCommandHandler("base",openMyGate1)
nodebugscript3 errors
please help