denny199 Posted August 18, 2012 Share Posted August 18, 2012 (edited) Hey there, i've helping my mate with a map but now we've got some problems with our script. evrything is working fine until chekpoint 27 When I hit chekpoint 26, I'm getting a random plane from the plane table. When i hit chekpoint 27, I'm getting a random car, that needs to be a plane. And when I hit chekpoint 28 it's getting the randomcar again. so, what wrong in my code? local carids = {568, 424, 573, 579, 400, 500, 444, 470, 489, 490, 495, 468, 471} local planeids = {592, 577, 511, 512, 593, 520, 553, 475, 519, 460, 513} local boatids = {471, 473, 493, 595, 484, 430, 453, 452, 446, 454} function randomCar(checkpoint, time) local veh = getPedOccupiedVehicle(source) if 1 <= checkpoint and checkpoint <= 25 then setElementModel (veh, carids[math.random(#carids)]) elseif checkpoint <= 26 then setElementModel (veh, planeids[math.random(#planeids)]) elseif checkpoint <= 31 then setElementModel (veh, carids[math.random(#carids)]) elseif checkpoint <= 35 then setElementModel (veh, boatids[math.random(#boatids)]) end end addEvent('onPlayerReachCheckpoint') addEventHandler('onPlayerReachCheckpoint', getRootElement(), randomCar) Edited August 18, 2012 by Guest Link to comment
Callum Posted August 18, 2012 Share Posted August 18, 2012 Well if you're at chekpoint 26 you're getting a plane, anything after falls under the conditional check at line 14, which gets a random car ID. Link to comment
denny199 Posted August 18, 2012 Author Share Posted August 18, 2012 Hmm, I don't understand you right so I need to change this?: elseif checkpoint <= 31 then to this:? elseif checkpoint >= 31 then I'm mind f*cked Link to comment
Callum Posted August 18, 2012 Share Posted August 18, 2012 >= means greater than or equal to > means greater than <= means less than or equal to < means less than == means equal to ~= means not equal to So, providing you have surpassed from the first year of primary school, you should be able to figure it out. Link to comment
denny199 Posted August 18, 2012 Author Share Posted August 18, 2012 Allright thanks, I already know this part again , I was dumb now. 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