Jump to content

Again weather system


Recommended Posts

Error:Line 23 : attemt to index local 'weather' (a nil value)

local weatherTable={            
    { weatherid=0, name="Nagyon meleg"},
    { weatherid=1, name="Meleg"},
    { weatherid=2, name="Napos, kissé ködös"},
    { weatherid=9, name="Ködös"},
}

local currentWeatherTable={}
function setNewWeather()
    while (#currentWeatherTable<7) do
        table.insert(currentWeatherTable,weatherTable[math.random(1,#weatherTable)])
    end
end

function weatherSystemStart()
    setWeather(1)
end
addEventHandler("onResourceStart", resourceRoot,setNewWeather)
addEventHandler("onResourceStart", resourceRoot,weatherSystemStart)

function newWeather()
    local weather=table.remove(currentWeatherTable,1)
    outputChatBox("The Weather changes. ("..weather.name..")",root,255,255,255,true)
    setWeather(weather.weatherid)
end
setTimer(newWeather,360,0)

Whats the problem?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...