Egor_Varaksa Posted March 6, 2021 Posted March 6, 2021 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 )
Overkillz Posted April 8, 2021 Posted April 8, 2021 Whats exactly do you want to do ? It is doing what you have coded.
Egor_Varaksa Posted April 8, 2021 Author Posted April 8, 2021 1 hour ago, Overkillz said: Whats exactly do you want to do ? It is doing what you have coded. How to make sure that it does not fall into the ground?
Moderators IIYAMA Posted April 8, 2021 Moderators Posted April 8, 2021 On 06/03/2021 at 17:47, Egor_Varaksa said: 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 ) Try this: function gatefuncclose( ) if isMoving then stopObject(parkgate1) stopObject(parkgate2) 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 )
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