I want to get a data from all accounts on the server, but i get this warning:
'getAccount' [Expected string at argument 1, got account]
'getAccountData' [Expected account at argument 1, got boolean]
this is my code:
for i, v in pairs(getAccounts()) do
names = getAccountData(getAccount(v), "acc:nickname")
end
outputChatBox(names)
What wrong?
Well you have to do it like this
addCommandHandler('getdata',function(player,commandName)
local playersData = {}
local accounts = getAccounts()
if player then
for k,account in ipairs(accounts) do
playersData[k] = getAccountData(account,"acc:nickname")
end
outputChatBox(tostring(inspect(playersData)),player)
end
end,false,false)