Egor_Varaksa 0 Posted March 7 Share Posted March 7 (edited) How do I fix this? https://youtu.be/UjKePNof-6A Code (server): parkgate1 = createObject( 968, 2777.123, 905.84, 10.666, 0, 90, 90 ) parkgate2 = createObject( 968, 2777.127, 920.71, 10.62, 0, -90, 90 ) gatebar1 = createObject( 966, 2777.127, 920.71, 9.7, 0, 0, 90 ) gatebar2 = createObject( 966, 2777.123, 905.84, 9.7, 0, 0, -90 ) parkmarker = createMarker(2777, 912.994, 7.75, "cylinder", 13, 255, 0, 0, 0 ) local isMoving = false function gatefunc( hitPlayer ) if isMoving == false then isMoving = true moveObject ( parkgate1, 2000, 2777.123, 905.84, 10.666, 0, -90, 0) moveObject ( parkgate2, 2000, 2777.127, 920.71, 10.62, 0, 90, 0) end end addEventHandler( "onMarkerHit", parkmarker, gatefunc ) function gatefuncclose( ) moveObject ( parkgate1, 2000, 2777.123, 905.84, 10.666, 0, 90, 0) moveObject ( parkgate2, 2000, 2777.127, 920.71, 10.62, 0, -90, 0) setTimer(function() isMoving = false end,2000,1) end addEventHandler( "onMarkerLeave", parkmarker, gatefuncclose ) Edited March 7 by Egor_Varaksa Link to post
andr0xy 204 Posted March 7 Share Posted March 7 The same way you did the first function, you should do in the second one. In this case, check if the isMoving is true. Link to post
Egor_Varaksa 0 Posted March 7 Author Share Posted March 7 18 minutes ago, andr0xy said: The same way you did the first function, you should do in the second one. In this case, check if the isMoving is true. It didn't help. Maybe you can somehow make the object not rotate more than 90 degrees? Link to post
andr0xy 204 Posted March 7 Share Posted March 7 Tested: Spoiler parkgate1 = createObject( 968, 2777.123, 905.84, 10.666, 0, 90, 90 ) parkgate2 = createObject( 968, 2777.127, 920.71, 10.62, 0, -90, 90 ) gatebar1 = createObject( 966, 2777.127, 920.71, 9.7, 0, 0, 90 ) gatebar2 = createObject( 966, 2777.123, 905.84, 9.7, 0, 0, -90 ) parkmarker = createMarker(2777, 912.994, 7.75, "cylinder", 13, 255, 0, 0, 0 ) local isMoving = false function gatefunc( hitPlayer ) if isMoving == false then moveObject ( parkgate1, 2000, 2777.123, 905.84, 10.666, 0, -90, 0) moveObject ( parkgate2, 2000, 2777.127, 920.71, 10.62, 0, 90, 0) setTimer(function() isMoving = true end, 2000, 1) end end addEventHandler( "onMarkerHit", parkmarker, gatefunc ) function gatefuncclose( ) if isMoving then moveObject ( parkgate1, 2000, 2777.123, 905.84, 10.666, 0, 90, 0) moveObject ( parkgate2, 2000, 2777.127, 920.71, 10.62, 0, -90, 0) setTimer(function() isMoving = false end, 2000, 1) end end addEventHandler( "onMarkerLeave", parkmarker, gatefuncclose ) I made a mistake by telling you to make the second function like the first one, actually it was first one like the second one, but adding a checker for isMoving variable. My bad Link to post
Egor_Varaksa 0 Posted March 7 Author Share Posted March 7 4 minutes ago, andr0xy said: Tested: Hide contents parkgate1 = createObject( 968, 2777.123, 905.84, 10.666, 0, 90, 90 ) parkgate2 = createObject( 968, 2777.127, 920.71, 10.62, 0, -90, 90 ) gatebar1 = createObject( 966, 2777.127, 920.71, 9.7, 0, 0, 90 ) gatebar2 = createObject( 966, 2777.123, 905.84, 9.7, 0, 0, -90 ) parkmarker = createMarker(2777, 912.994, 7.75, "cylinder", 13, 255, 0, 0, 0 ) local isMoving = false function gatefunc( hitPlayer ) if isMoving == false then moveObject ( parkgate1, 2000, 2777.123, 905.84, 10.666, 0, -90, 0) moveObject ( parkgate2, 2000, 2777.127, 920.71, 10.62, 0, 90, 0) setTimer(function() isMoving = true end, 2000, 1) end end addEventHandler( "onMarkerHit", parkmarker, gatefunc ) function gatefuncclose( ) if isMoving then moveObject ( parkgate1, 2000, 2777.123, 905.84, 10.666, 0, 90, 0) moveObject ( parkgate2, 2000, 2777.127, 920.71, 10.62, 0, -90, 0) setTimer(function() isMoving = false end, 2000, 1) end end addEventHandler( "onMarkerLeave", parkmarker, gatefuncclose ) I made a mistake by telling you to make the second function like the first one, actually it was first one like the second one, but adding a checker for isMoving variable. My bad Thanks, but now if you quickly pass the marker the barrier will remain open Link to post
andr0xy 204 Posted March 7 Share Posted March 7 Yes, I could notice that too. That's weird, because the x, y and z axis don't seem to have this behaviour, it's just the rotation. Dunno what you should do to solve it, without some workaround. 1 Link to post
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