Jump to content

[HELP] Why i cant get data from all accounts?


Recommended Posts

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?

  • Like 1
Link to comment

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)   

 

  • Thanks 1
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...