Mayfair Posted November 30, 2008 Share Posted November 30, 2008 Hello there, Please excuse my noob questions, I'm quite new to creating scripts for MTA:SA. I was wondering if anyone could help me out regarding creating a function (Script) to spawn your car on (near) your cords. For example: If I bought a car in MTA:SA (My server) and someone came and stole my car and drove off, I could click a button(Get Car) and it will spawn(Teleport) my owned car to me even if the guy is driving it. I'm sure I saw this function in another server, But unfortunately I only have little knowledge creating scripts for MTA:SA. I was thinking that I could be done with (Get element) or something like that, But as I said I don’t know where to start, Because of noob knowledge of creating scripts for MTA:SA. Also I was thinking of having a button called (Boom) and that would set my owned car on fire and blow up, so if someone stole my owned car I could set it on fire and blow it up, then click the (Get Car) button to re spawn the car on my cords. If someone could help me or point me into the correct direction that would be superb. Thank you ever so much. -Mayfair Link to comment
Lordy Posted December 1, 2008 Share Posted December 1, 2008 You have to bind the vehicle element to your client element. Possibly with setElementData or tables. Then getElementPosition to get your coords and setElementPosition to set the car's position next you. Then you also have to apply your rotation and warp urself into that car maybe if you want. Or did you mean anything else? Link to comment
Mayfair Posted December 2, 2008 Author Share Posted December 2, 2008 You have to bind the vehicle element to your client element. Possibly with setElementData or tables. Then getElementPosition to get your coords and setElementPosition to set the car's position next you. Then you also have to apply your rotation and warp urself into that car maybe if you want.Or did you mean anything else? Ok thank you very much LordAzamth, I'll start working on it and let you know how i get on First i'll try read online to get some experience. Thank you. Link to comment
DakiLLa Posted December 2, 2008 Share Posted December 2, 2008 try to see here example 3,i think you need it.. Link to comment
Gamesnert Posted December 2, 2008 Share Posted December 2, 2008 try to see here example 3,i think you need it.. He meant teleporting an existing car. Anyway, I recommend making a script like this yourself. It should help you on the long-term. There are several functions that can help you: -getElementPosition: To get the player's position to set the vehicle's position to. -setElementPosition: To set the vehicles position. -setElementData: You can use it like: (player,"car",the vehicle variable), so you can always know what vehicle is his in any resource. -getElementData: This is used to retrieve it from setElementData. -removePlayerFromVehicle: To make sure it's empty before teleport. You don't want to teleport the car with the player just so he could drive away again. If you still need to learn how to script: http://development.mtasa.com/index.php? ... troduction Good luck. If you need help with things, you can always ask on the forums. But try to figure out how things work yourself first! Look at the examples and any information that may be of help. Link to comment
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