iiv03 Posted November 26, 2019 Share Posted November 26, 2019 well i was make table with function setWeather i'm tired to add table out function and connect to outputChatBox so my try: local weatherName = {"Test1","Test2","Test3"}--tables function changeWeather(player, command, state, weatherID, weatherName) local account = getPlayerAccount (player) local account_name = getAccountName(account) if isObjectInACLGroup ( "user." .. account_name, aclGetGroup ( "Admin" )) then if not state then outputChatBox("write a weather!", player, 255,255,255,true) return end if state == "weather" then setWeather(tonumber(weatherID)) --Set the weather and let the player know he did it outputChatBox("Weather successfully changed to "..weatherName, player, 0, 255, 0) -- here get a weathername when set id of weathers! else outputChatBox("Access Denied", player, 255,255,255,true) end end end addCommandHandler("change", changeWeather) i'm getting error attempt to concatenate local 'weatherName' (a nil value) Link to comment
JeViCo Posted November 26, 2019 Share Posted November 26, 2019 Problem hides here: function changeWeather(player, command, state, weatherID, weatherName) your function redefines value of weatherName variable in current scope. You probably want this (inside your function): local selected = weatherName[tonumber(weatherID)] -- get text from table also remove last function argument to make everything work function changeWeather(player, command, state, weatherID) 1 Link to comment
iiv03 Posted November 27, 2019 Author Share Posted November 27, 2019 21 hours ago, JeViCo said: Problem hides here: function changeWeather(player, command, state, weatherID, weatherName) your function redefines value of weatherName variable in current scope. You probably want this (inside your function): local selected = weatherName[tonumber(weatherID)] -- get text from table also remove last function argument to make everything work function changeWeather(player, command, state, weatherID) Thanks 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