ZH-CN/getAccounts: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
{{Server function}}
{{Server function}}
此函数用于返回服务器中存在的所有帐户[[account]]的表internal.db文件.(注:accounts.xml在版本1.0.4之后不再使用)[[账户]]
此函数用于返回服务器中存在的所有帐户[[account]]的表internal.db文件.(注:accounts.xml在版本1.0.4之后不再使用)[[账户]]
==Syntax==
==语法==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
table getAccounts ()
table getAccounts ()
</syntaxhighlight>
</syntaxhighlight>
{{OOP|This function is a static function underneath the Account class.|[[Account]].getAll||}}
{{OOP_ZH-CN|This function is a static function underneath the Account class.|[[Account]].getAll||}}
===Returns===
===Returns===
A [[table]] over the accounts that exist in the server internal.db file. This table might be empty.
A [[table]] over the accounts that exist in the server internal.db file. This table might be empty.


==Example==
==示例==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function printAmountOfAccounts ( thePlayer )
function printAmountOfAccounts ( thePlayer )
Line 29: Line 29:
[[ru:getAccounts]]
[[ru:getAccounts]]


[[zh-cn:getAccounts]]
[[en:getAccounts]]

Revision as of 07:59, 5 February 2021

此函数用于返回服务器中存在的所有帐户account的表internal.db文件.(注:accounts.xml在版本1.0.4之后不再使用)账户

语法

table getAccounts ()

OOP 语法 什么是OOP?

提示: This function is a static function underneath the Account class.
方法: Account.getAll(...)

Returns

A table over the accounts that exist in the server internal.db file. This table might be empty.

示例

function printAmountOfAccounts ( thePlayer )
    local accountTable = getAccounts () -- return the table over accounts
    if #accountTable == 0 then -- if the table is empty
        outputChatBox( "There are no accounts. :(", thePlayer )
    else -- table isn't empty
        outputChatBox( "There are " .. #accountTable .. " accounts in this server!", thePlayer )
    end
end
addCommandHandler( "accountcount", printAmountOfAccounts ) -- add a command handler for command 'accountcount'

See Also