LiOneLMeSsIShoT Posted July 19, 2013 Share Posted July 19, 2013 When i write /gate... and open..the gate don't back to the position after the timer local gate1 = createObject ( 16773, 2506.5, -2110.5, 16.5, 0, 0, 0) local gate2 = createObject ( 16773, 2521.1000976563, -2110.5, 16.5, 0, 0, 0) function MoveObject (thePlayer) local team = getPlayerTeam(thePlayer) local x, y, z = getElementPosition(thePlayer) local distance = getDistanceBetweenPoints3D(2513.6999511719, -2110.6000976563, 13.5, x, y, z) if (distance <= 10) then if (team==getTeamFromName("ZombieTeam")) then moveObject (gate1, 5000, 2494.5, -2110.3000488281, 16.5) moveObject (gate2, 5000, 2532.6000976563, -2110.1000976563, 16.5) setTimer (moveBack, 6500, 1) outputChatBox ("Welcome", thePlayer, 0, 255, 0) end end end addCommandHandler ("gate", MoveObject) function moveBack () moveObject (gate1, 2506.5, -2110.5, 16.5) moveObject (gate2, 2521.1000976563, -2110.5, 16.5) end ERRORS!: FactoryGate.lua:22: Bad argument @ 'moveObject' [expected number at argument 5, got none] FactoryGate.lua:23: Bad argument @ 'moveObject' [expected number at argument 5, got none] Link to comment
DNL291 Posted July 19, 2013 Share Posted July 19, 2013 Try this: local gate1 = createObject ( 16773, 2506.5, -2110.5, 16.5, 0, 0, 0) local gate2 = createObject ( 16773, 2521.1000976563, -2110.5, 16.5, 0, 0, 0) function MoveObject (thePlayer) local team = getPlayerTeam(thePlayer) local x, y, z = getElementPosition(thePlayer) local distance = getDistanceBetweenPoints3D(2513.6999511719, -2110.6000976563, 13.5, x, y, z) if (distance <= 10) then if (team==getTeamFromName("ZombieTeam")) then moveObject (gate1, 5000, 2494.5, -2110.3000488281, 16.5) moveObject (gate2, 5000, 2532.6000976563, -2110.1000976563, 16.5) setTimer (moveBack, 6500, 1) outputChatBox ("Welcome", thePlayer, 0, 255, 0) end end end addCommandHandler ("gate", MoveObject) function moveBack () moveObject (gate1, 5000, 2506.5, -2110.5, 16.5) moveObject (gate2, 5000, 2521.1000976563, -2110.5, 16.5) end Link to comment
LiOneLMeSsIShoT Posted July 19, 2013 Author Share Posted July 19, 2013 Try this: local gate1 = createObject ( 16773, 2506.5, -2110.5, 16.5, 0, 0, 0) local gate2 = createObject ( 16773, 2521.1000976563, -2110.5, 16.5, 0, 0, 0) function MoveObject (thePlayer) local team = getPlayerTeam(thePlayer) local x, y, z = getElementPosition(thePlayer) local distance = getDistanceBetweenPoints3D(2513.6999511719, -2110.6000976563, 13.5, x, y, z) if (distance <= 10) then if (team==getTeamFromName("ZombieTeam")) then moveObject (gate1, 5000, 2494.5, -2110.3000488281, 16.5) moveObject (gate2, 5000, 2532.6000976563, -2110.1000976563, 16.5) setTimer (moveBack, 6500, 1) outputChatBox ("Welcome", thePlayer, 0, 255, 0) end end end addCommandHandler ("gate", MoveObject) function moveBack () moveObject (gate1, 5000, 2506.5, -2110.5, 16.5) moveObject (gate2, 5000, 2521.1000976563, -2110.5, 16.5) end Wow! Worked Fine 10000% And i understanded what was the fucken mistake It's Shit! with the time Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now