GetAccountsBySerial: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(OOP syntax added)
m (Добавление языков)
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
{{New items|4.0132|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.
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.
}}
}}
Line 10: Line 10:
table getAccountsBySerial ( string serial )
table getAccountsBySerial ( string serial )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||Account.getAllBySerial||}}
{{OOP|This function is a static function underneath the Account class.|Account.getAllBySerial||}}
===Required Arguments===  
===Required Arguments===  
*'''serial:''' The [[serial]] to get accounts from
*'''serial:''' The [[serial]] to get accounts from
Line 30: Line 30:
==See Also==
==See Also==
{{Account_functions}}
{{Account_functions}}
[[en:getAccountsBySerial]]
[[ru:getAccountsBySerial]]
[[pl:getAccountsBySerial]]
[[zh-cn:getAccountsBySerial]]

Latest revision as of 13:23, 12 April 2021

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.


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