Jump to content

Help please


Recommended Posts

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 )

 

Link to post
  • 1 month later...
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 )

 

 

Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...