GetAllAccountData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} This function returns a table containing all the user data for the account provided ==Syntax== <syntaxhighlight lang="lua"> table getAccountAllData ( account theAcco...")
 
m (Добавление языков)
 
(12 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Server function}}
This function returns a table containing all the user data for the account provided
This function returns a table containing all the user data for the [[account]] provided
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
table getAccountAllData ( account theAccount )
table getAllAccountData ( account theAccount )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[account]]:getAllData|data|}}
===Required Arguments===
*'''theAccount:''' The account you wish to retrieve all data from.


===Returns===
===Returns===
Line 15: Line 18:
     local playerAccount = getPlayerAccount( thePlayer ) -- get his account
     local playerAccount = getPlayerAccount( thePlayer ) -- get his account
     if ( playerAccount ) then -- if we got the account then
     if ( playerAccount ) then -- if we got the account then
         local data = getAccountAllData( playerAccount ) -- get data
         local data = getAllAccountData( playerAccount ) -- get data
         count = 0
         count = 0
         for _ in pairs(data) do count = count + 1 end -- get the count
         for _ in pairs(data) do count = count + 1 end -- get the count
Line 28: Line 31:
addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall'
addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall'
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|1.3.0-9.03804|n/a|}}


==See Also==
==See Also==
{{Account functions}}
{{Account functions}}
[[en:getAllAccountData]]
[[ru:getAllAccountData]]
[[zh-cn:GetAllAccountData]]

Latest revision as of 13:31, 12 April 2021

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

Syntax

table getAllAccountData ( account theAccount )

OOP Syntax Help! I don't understand this!

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


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.

Example

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" ) -- output number of rows
        if ( data ) then
            for k,v in pairs ( data ) do
                outputChatBox(k..": "..v) -- print the key and value of each entry of data
            end
        end
    end
end
addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall'

Requirements

Minimum server version 1.3.0-9.03804
Minimum client version n/a

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.3.0-9.03804" />

See Also