Jump to content

moveObject Problem


justn

Recommended Posts

Hi, I have a problem with this script im making ( for jail break ).. well, the problem is that the gate doesn't move.. i would like if someone can help please :/ thanks.

gate1 = createObject(980, 3535.1999511719, -1804.6999511719, 28.39999961853, 0, 0, 270) 
gate2 = createObject(980, 3535.3000488281, -1815.5999755859, 28.39999961853, 0, 0, 270) 
  
addEventHandler("onClientMarkerHit",marker, 
function(hitElement,matchingDimension) 
if ( hitElement == localPlayer ) then 
if not isPedInVehicle(localPlayer) and isElementWithinMarker(localPlayer,marker) then 
guiSetVisible(JailBreak_Progress,true) 
timer1 = setTimer(function() 
guiProgressBarSetProgress(JailBreak_Progress,guiProgressBarGetProgress(JailBreak_Progress)+1) 
end,1000,0) 
timer2 = setTimer(moveGate,5000,1) 
timer3 = setTimer(label,1000,0) 
end 
end 
end) 
  
function moveGate() 
if  ( guiProgressBarGetProgress(JailBreak_Progress) == 100 ) then 
moveObject(gate1, 2000, 3535.3000488281, -1815.5999755859, 20.39999961853) 
moveObject(gate2, 2000, 3535.3000488281, -1815.5999755859, 20.39999961853) 
setTimer(function() 
moveObject(gate1, 2000, 3535.1999511719, -1804.6999511719, 28.39999961853) 
moveObject(gate2, 2000, 3535.1999511719, -1804.6999511719, 28.39999961853) 
end,20000,1) 
end 
end 

Link to comment

If your progress bar's value from the start is 0, then it would need 100 seconds to be filled. moveGate will be called after 5 seconds, the progress bar wouldn't equal 100 by that time, that's why it doesn't work.

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