XxCozzaxX Posted August 5, 2011 Posted August 5, 2011 Okay, so here's my code: privategatesphere = createColSphere ( 1394, -2438, 14, 12 ) privateGate = createObject(16773, 1393.1313476563, -2438.46875, 16.553903579712, 16, 0, 270) function openprivateGate() if (getPlayerFromName("crwblyth" or "XxHEWESxX")) then moveObject(privateGate, 7000, 1390.3840332031, -2438.361328125, 20.691507339478) end end function closeprivateGate() if (getPlayerFromName("crwblyth" or "XxHEWESxX")) then moveObject(privateGate, 7000, 1393.1313476563, -2438.46875, 16.553903579712) end end addEventHandler ( "onColShapeHit", privategatesphere, openprivateGate ) addEventHandler ( "onColShapeLeave", privategatesphere, closeprivateGate ) This opens a gate when the colshape is hit and closes it when it is left But what happens when one person enters as the other leaves? There is a clash here, any ideas how I could code it so it would work properly? Regards, Cozza
JR10 Posted August 5, 2011 Posted August 5, 2011 Try: privategatesphere = createColSphere ( 1394, -2438, 14, 12 ) privateGate = createObject(16773, 1393.1313476563, -2438.46875, 16.553903579712, 16, 0, 270) local isGateMoving = false function openprivateGate() if (getPlayerFromName("crwblyth" or "XxHEWESxX")) then if isGateMoving then return end moveObject(privateGate, 7000, 1390.3840332031, -2438.361328125, 20.691507339478) isGateMoving = true setTimer(function() isGateMoving = false end,7000,1) end end function closeprivateGate() if (getPlayerFromName("crwblyth" or "XxHEWESxX")) then if isGateMoving then return end moveObject(privateGate, 7000, 1393.1313476563, -2438.46875, 16.553903579712) isGateMoving = true setTimer(function() isGateMoving = false end,7000,1) end end addEventHandler ( "onColShapeHit", privategatesphere, openprivateGate ) addEventHandler ( "onColShapeLeave", privategatesphere, closeprivateGate )
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