GetAccountSerial: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (→‎Syntax: OOP)
m (Edited language change)
 
(7 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
{{New items|4.0132|1.4|
{{New items|3.0140|1.4|
This function returns the last [[serial]] that logged onto the specified [[account]].
This function returns the last [[serial]] that logged onto the specified [[account]].
}}
}}
Line 10: Line 10:
string getAccountSerial ( account theAccount )
string getAccountSerial ( account theAccount )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP|This function is also a static function underneath the Account class.|[[account]]:getSerial|serial|}}
{{OOP||[[account]]:getSerial|serial|}}
===Required Arguments===  
===Required Arguments===  
*'''theAccount:''' The [[account]] to get serial from
*'''theAccount:''' The [[account]] to get serial from
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)
      if accountName then
if (account) then
local account = getAccount(accountName)
outputChatBox("Serial: " .. getAccountSerial(account))
if (account) then
else
    outputChatBox("Serial: " .. getAccountSerial(account))
outputChatBox("Account not found")
else
end
    outputChatBox("Account not found")
end)
end
    end
end
)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Account_functions}}
{{Account_functions}}
[[ru:getAccountSerial]]
[[zh-cn:getAccountSerial]]

Latest revision as of 15:23, 8 June 2022

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)
      if accountName then 
	 local account = getAccount(accountName)
	 if (account) then
	     outputChatBox("Serial: " .. getAccountSerial(account))
	 else
	     outputChatBox("Account not found")
	 end
     end
 end
)

See Also