SnoopCat Posted April 26, 2011 Share Posted April 26, 2011 hey i have a skygradient and water color script but i want to make it changes to a random color every 5 mins how i can do this???? here is the cod ei have: addEventHandler("onClientResourceStop", getRootElement(), function() resetWaterColor() end) addEventHandler("onClientResourceStart", getRootElement(), function() setWaterColor(4, 140, 251) end) addEventHandler("onClientResourceStart", getRootElement(), function() setSkyGradient(255, 128, 0 , 0 , 0 , 0) end) Link to comment
Antibird Posted April 26, 2011 Share Posted April 26, 2011 1. You need to get random values and put em into setSkyGradient() and setWaterColor() 2. You need a timer to cycle it every 5 minutes ( 300000 milliseconds) So what comes straight on my mind is: (didn't test) setTimer( function() setSkyGradient( math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ) ) setWaterColor( math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ) ) end , 300000, 0 ) Link to comment
SnoopCat Posted April 26, 2011 Author Share Posted April 26, 2011 Thart script work but when a map get started it get to the map default colors and i want to keep the colors of the script Link to comment
Lex128 Posted April 27, 2011 Share Posted April 27, 2011 Use: addEventHandler("onClientResourceStop", getRootElement(),function() resetSkyGradient() resetWaterColor() end) addEventHandler("onClientResourceStart",getRootElement(),function() setSkyGradient(math.random(0,255),math.random(0,255),math.random(0,255),math.random(0,255),math.random(0,255),math.random(0,255)) setWaterColor(math.random(0,255),math.random(0,255),math.random(0,255)) setTimer(function() setSkyGradient(math.random(0,255),math.random(0,255),math.random(0,255),math.random(0,255),math.random(0,255),math.random(0,255)) setWaterColor(math.random(0,255),math.random(0,255),math.random(0,255)) end,300000,0) end) 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