LabiVila Posted August 20, 2015 Share Posted August 20, 2015 local clans = {} function createClan (player, cmd, password, ...) local acc = getPlayerAccount (player) local cName = table.concat ({...}, " ") if not password or not (...) then return outputChatBox ("t Syntax error, /addc password clanName", player, 255, 255, 255) end if acc and isGuestAccount (acc) then return outputChatBox ("This command is disabled for guests.", player, 255, 255, 255) end if clans[cName] then return outputChatBox ("There is a clan with such name.", player, 255, 255, 255) end for a,b in ipairs (clans[cName].members) do if (b == player) then outputChatBox ("You are in a clan already.", player, 255, 255, 255) end end outputChatBox ("You have created a clan called '"..cName.."', password is '"..password.."'.", player, 255, 255, 255) clans [cName] = {members = {player}, cPass = {password}} setAccountData (acc, "currentClan", cName) setAccountData (acc, "LeaderState", cName) end addCommandHandler ("addc", createClan) The error is: Attempt to index field '?' (a nil value), line 15 and 19 Link to comment
Mr.Loki Posted August 20, 2015 Share Posted August 20, 2015 you have not inserted clans[cName] into the clans table yet Link to comment
LabiVila Posted August 21, 2015 Author Share Posted August 21, 2015 Fixed, that isn't the problem, that's why I'm checking if there is one.. thanks anyway 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