Jump to content

MoveObject help


Recommended Posts

Hello, I would like to resolve that if the gate is opened, it is possible to pass through it, but only for a while. Like a border system.
 
 
 
addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement)
    if GateMenu and button == "left" and state == "down" then
        if isMouseInPosition(sx*.42, sy*.6, sx*.15, sy*.08) then
            GateMenu = false
            moveObject(TheGate, 5000, 51.62455, -1524.62549, 0)
				GateStatus = true
                 triggerEvent("Reset", localPlayer)
            end
        end
    end
)
addEvent("Reset", true)
addEventHandler("Reset", root,
function()
       if (GateStatus) then
moveObject(TheGate, 100000, 1468, 51.62455, -1524.62549, 5.05399)
end
end
)

 

Link to comment
 
function isMouseInPosition ( x, y, width, height )
	if ( not isCursorShowing( ) ) then
		return falsew
	end
	local sx, sy = guiGetScreenSize ( )
	local cx, cy = getCursorPosition ( )
	local cx, cy = ( cx * sx ), ( cy * sy )
	
	return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end
addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement)
    if GateMenu and button == "left" and state == "down" then
        if isMouseInPosition(sx * 0.42, sy * 0.6, sx * 0.15, sim * 0.08) then
            GateMenu = false
            moveObject(TheGate, 5000, 51.62455, -1524.62549, 0)
            GateStatus = true
            triggerEvent("Reset", localPlayer)
        end
    end
end)

addEvent("Reset", true)
addEventHandler("Reset", root, function()
    if GateStatus then
        moveObject(TheGate, 100000, 1468, 51.62455, -1524.62549, 5.05399)
    end
end)


tenta aassim meu querido pelo que eu li no seu codigo vc nao usou essa funçao no seu codigo if GateMenu and button == "left" and state == "down" then

 

e nao tem a funçao userfull 

function isMouseInPosition ( x, y, width, height )
	if ( not isCursorShowing( ) ) then
		return false
	end
	local sx, sy = guiGetScreenSize ( )
	local cx, cy = getCursorPosition ( )
	local cx, cy = ( cx * sx ), ( cy * sy )
	
	return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end

tenta ai se nao der certo vem pv madrugadao#7712

 

 

Link to comment

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...