damien111 Posted August 10, 2012 Share Posted August 10, 2012 I want my script top randomly pick 1 of 10 or 20 functions to execute. This is for taxi script. The script will first detect if he is in a taxi. The player will randomly be given a marker to go to with a per near it. When he enters the marker the ped is warped to the car,he has to take it to another marker. Then the random chooser function is executed again and so forth. My only problem so far is with this random choosing thing. Can someone point me in the right direction. Thanks Written with my kindle fire sorry bout any typos!!!! Link to comment
Castillo Posted August 10, 2012 Share Posted August 10, 2012 Each function does the same but with different coordinates? if so, then you should make a coordinates table and just one function. Link to comment
damien111 Posted August 10, 2012 Author Share Posted August 10, 2012 Then how do I make randomly choose one. Like show me what you mean. Also how do I detect if a player is in certain car? Is it like getplayervehicle. Thx Link to comment
Castillo Posted August 10, 2012 Share Posted August 10, 2012 First, we make the table with many coordinates: local coordinates = { { 0, 0, 5 }, { 0, 0, 10 } } second, we make a function to get random from it: function getRandomCoordinates ( ) return unpack ( coordinates [ math.random ( #coordinates ) ] ) end And third, we use our function: x, y, z = getRandomCoordinates ( ) About the vehicle, you can use getPedOccupiedVehicle. Link to comment
damien111 Posted August 10, 2012 Author Share Posted August 10, 2012 Thankyou so much, I will script it tomorrow. You are the only reason I didn't give up on scripting. I would've gave up when I got stuck the second time probally . Ps. Love SAUR 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