kevin11 Posted June 1, 2010 Share Posted June 1, 2010 (edited) hey i wanna stop this at 28 seconds but it doesnt work adn doesnt give any error function randomVehColors() for i, car in ipairs( getElementsByType( "vehicle" ) ) do local color = {} color[1] = math.random(0,126) -- random from 0 to 126, because colors is from 0 to 126 color[2] = math.random(0,126) color[3] = math.random(0,126) color[4] = math.random(0,126) -- we take 4 random numbers because setVehicleColor have parameters with 4 colors setVehicleColor ( car, color[1], color[2], color[3], color[4] ) -- setting color to vehicle setSkyGradient(math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255)) end end addCommandHandler("command", function () setTimer( randomVehColors, 500, 0 ) end) Edited June 2, 2010 by Guest Link to comment
The_Ex Posted June 1, 2010 Share Posted June 1, 2010 this is really wrong. Have you ever thought about what each part of your code does? Link to comment
kevin11 Posted June 1, 2010 Author Share Posted June 1, 2010 this is really wrong.Have you ever thought about what each part of your code does? k that helps... anyway yes i do and im not good at scripting Link to comment
Dark Dragon Posted June 1, 2010 Share Posted June 1, 2010 where is your 'randomVehColors' function? put the ) behind the first 'end' Link to comment
Jumba' Posted June 1, 2010 Share Posted June 1, 2010 Just post the whole code. And that snippet you just wrote fails epically, after end you're supposed to put a ) to close the command handler, thought I have no idea if that's what you want. Link to comment
kevin11 Posted June 1, 2010 Author Share Posted June 1, 2010 k can u help me now? i added all Link to comment
50p Posted June 2, 2010 Share Posted June 2, 2010 What's the point of 2 timers? Just use one and for the last parameter use a number of how many times you want the timer to call the randomVehColors function... If your timer has interval of 250 then set 3rd param to 112 (1000 / 250 = 4 * 28 = 112) If it's 500 then use 56 (1000 / 500 = 2 * 28 = 56) Link to comment
kevin11 Posted June 2, 2010 Author Share Posted June 2, 2010 no i mean that carcolors/skygradient stops after 28sec Link to comment
50p Posted June 2, 2010 Share Posted June 2, 2010 no i mean that carcolors/skygradient stops after 28sec hey i wanna stop this at 28 seconds Remove 1 timer and try again... There is no point of having 2 timers which execute the same function every half second at the same time. 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