ZH-CN/getAccountSerial: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} {{New items|3.0140|1.4| This function returns the last serial that logged onto the specified account. }} ==Syntax== <syntaxhighlight...")
 
m (Добавление языков)
 
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:
{{Server function}}
{{Server function}}
{{New items|3.0140|1.4|
{{New items|3.0140|1.4|
This function returns the last [[serial]] that logged onto the specified [[account]].
此函数返回上次登录到指定账户[[account]]的序列[[serial]]
}}
}}




==Syntax==  
==语法==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string getAccountSerial ( account theAccount )
string getAccountSerial ( account theAccount )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[account]]:getSerial|serial|}}
{{OOP_ZH-CN||[[account]]:getSerial|serial|}}
===Required Arguments===  
===Required Arguments===  
*'''theAccount:''' The [[account]] to get serial from
*'''theAccount:''' 要从中获取序列号的帐户


===Returns===
===返回值===
Returns ''string'' containing the serial, the string is empty if the account was never used. Returns ''false'' if invalid arguments were specified.
返回包含序列号的“字符串”,如果从未使用过帐户,则该字符串为空。如果指定了无效参数,则返回“false”.


==Example==
==示例==
This example adds command ''getaccserial'' that outputs the given account's serial in the chat box.
此示例添加命令“getaccserial”,该命令在聊天框中输出给定帐户的序列号.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler("getaccserial",  
addCommandHandler("getaccserial",  
Line 38: Line 38:


[[ru:getAccountSerial]]
[[ru:getAccountSerial]]
 
[[en:getAccountSerial]]
[[zh-cn:getAccountSerial]]
[[zh-cn:getAccountSerial]]

Latest revision as of 13:04, 12 April 2021

此函数返回上次登录到指定账户account的序列serial


语法

string getAccountSerial ( account theAccount )

OOP 语法 什么是OOP?

方法: account:getSerial(...)
变量: .serial

Required Arguments

  • theAccount: 要从中获取序列号的帐户

返回值

返回包含序列号的“字符串”,如果从未使用过帐户,则该字符串为空。如果指定了无效参数,则返回“false”.

示例

此示例添加命令“getaccserial”,该命令在聊天框中输出给定帐户的序列号.

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