ZH-CN/getAccountsBySerial: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} {{New items|3.014|1.4| This function returns a table containing all accounts that were logged onto from specified serial. If the serial...")
 
No edit summary
Line 2: Line 2:
{{Server function}}
{{Server function}}
{{New items|3.014|1.4|
{{New items|3.014|1.4|
This function returns a [[table]] containing all accounts that were logged onto from specified [[serial]]. If the serial is empty string, it will return all accounts that were never logged onto.
此函数返回一个表[[table]],其中包含从指定的序列号[[serial]]登录的所有帐户。如果序列是空字符串,它将返回所有从未登录的帐户.
}}
}}



Revision as of 06:27, 4 February 2021

此函数返回一个表table,其中包含从指定的序列号serial登录的所有帐户。如果序列是空字符串,它将返回所有从未登录的帐户.


Syntax

table getAccountsBySerial ( string serial )

OOP Syntax Help! I don't understand this!

Note: This function is a static function underneath the Account class.
Method: Account.getAllBySerial(...)


Required Arguments

  • serial: The serial to get accounts from

Returns

Returns table containing the accounts associated with specified serial. Returns false if invalid arguments were specified.

Example

This example adds command getAccounts that outputs the number of accounts a player has in the chat box.

addCommandHandler("getAccounts", 
	function (player, cmd)
		local serial = getPlayerSerial(player)
		local accounts = getAccountsBySerial(serial)
		outputChatBox("You have " .. #accounts .. " accounts.", player)
	end)

See Also