Jump to content

Need help to make script (object move)


MTA FANAT

Recommended Posts

Yeah, definitely use colshapes. Its a pain in the ass to use commands. Make sure the colshape only triggers for what element you want it to trigger on. For instance, if you don't add this check, if someone drives in it, it will trigger for both the vehicle AND the player. do something like this:

function openGate(theElement,matchingDimension)
if (source == theColShape and getElementType(theElement) == "player") then
moveObject(.......)
end
end

Also make sure you add an event handler and function for when they exit the col shape so the gate will automatically close. As for the actual movement of the object, go to the wiki (development.mtasa.com) and search for moveObject. What you are going to have to do is create the object in the closed position, get the coordinates (and rotation too!) and then move the object to the open position, then do the same. Once you do that, for the function that opens the gate, tell it to move the gate to the open position. For when you exit, trigger a function that moves the gate to the closed position. You can even put restrictions to who or what opens it too, such as teams or what kind of element. That's another subject though. Try out what I said and I'm sure you will find success. :)

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