getAllAccountData | Multi Theft Auto: Wiki Skip to content

getAllAccountData

Client-side
Server-side
Shared

This function returns a table containing all the user data for the account provided.

OOP Syntax Help! I don't understand this!

  • Method:account:getAllData(...)
  • Variable: .data

Syntax

table|false getAllAccountData ( ​account theAccount )
Required arguments
  • theAccount: The account you wish to retrieve all data from.

Returns

A table containing all the user data, this table might be empty. false if invalid argument.

  • table|false: accounts table

Code Examples

server

This example retrieves and displays all account data of the player who typed the getall command in the chat, in the format key: value.

function printAllData(thePlayer)
local playerAccount = getPlayerAccount(thePlayer) -- get his account
if (playerAccount) then -- if we got the account then
local data = getAllAccountData(playerAccount) -- get data
count = 0
for _ in pairs(data) do count = count + 1 end -- get the count
outputChatBox("table holds " .. count .. " entries", thePlayer) -- output number of rows
if (data) then
for k, v in pairs(data) do
outputChatBox(k .. ": " .. v, thePlayer) -- print the key and value of each entry of data
end
end
end
end
addCommandHandler("getall", printAllData) -- add a command handler for command 'getall'