how would i go on about when its raining to change the timer to a shorter time and then resettting back to the normal time
[CODE]local randomweathers = {"sunny", "cloudy", "rain", }
timer.Create("awesomerandomizerlol", 1200, 0, function()
SetGlobalString("weather",table.Random( randomweathers ))
end)[/CODE]
[lua]
local randomweathers = {"sunny", "cloudy", "rain", } -- table
local function RandomWeatherSelect() -- zeh functio
local time = 0 -- the time var
local rand = table.Random( randomweathers ) -- the weather random
if rand == "sunny" then time = 1200 -- if its sunny
elseif rand == "rain" then time = 600 -- if its rainy
else time = 900 -- every thing else
end
SetGlobalString("weather", rand) -- Sets the global
-- args: (name, delay, loops, function)
timer.Create("awesomerandomizerlol", time, 1, RandomWeatherSelec) -- create/recreate the timer
end
RandomWeatherSelect() -- cals the function so it starts direcly when loaded
[/lua]
Sorry, you need to Log In to post a reply to this thread.