GetAccountSerial: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (fix oop syntax)
No edit summary
Line 21: Line 21:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler("getaccserial",  
addCommandHandler("getaccserial",  
function (player, cmd, account)
function (player, cmd, accountName)
account = getAccount(account)
local account = getAccount(accountName)
if (account) then
if (account) then
outputChatBox("Serial: " .. getAccountSerial(account))
outputChatBox("Serial: " .. getAccountSerial(account))

Revision as of 15:30, 20 September 2015

This function returns the last serial that logged onto the specified account.


Syntax

string getAccountSerial ( account theAccount )

OOP Syntax Help! I don't understand this!

Method: account:getSerial(...)
Variable: .serial


Required Arguments

  • theAccount: The account to get serial from

Returns

Returns string containing the serial, the string is empty if the account was never used. Returns false if invalid arguments were specified.

Example

This example adds command getaccserial that outputs the given account's serial in the chat box.

addCommandHandler("getaccserial", 
	function (player, cmd, accountName)
		local account = getAccount(accountName)
		if (account) then
			outputChatBox("Serial: " .. getAccountSerial(account))
		else
			outputChatBox("Account not found")
		end
	end)

See Also