ZH-CN/GetAccountName: Difference between revisions
Jump to navigation
Jump to search
Qwe7769611 (talk | contribs) (Created page with "{{Server function}} __NOTOC__ This function retrieves the name of an account. ==Syntax== <syntaxhighlight lang="lua"> string getAccountName ( account theAccount ) </synt...") |
Qwe7769611 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{Server function}} | {{Server function}} | ||
__NOTOC__ | __NOTOC__ | ||
此函数用于获取帐户[[account]]的名称. | |||
== | ==语法== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string getAccountName ( account theAccount ) | string getAccountName ( account theAccount ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | {{OOP_ZH-CN||[[account]]:getName|name|}} | ||
=== | ===必填函数=== | ||
*'''theAccount:''' | *'''theAccount:''' 你希望获得的帐户名称. | ||
===Returns=== | ===Returns=== | ||
如果帐户不存在或传递给函数的参数无效,则返回包含帐户名“false”的字符串. | |||
== | ==示例== | ||
当一个玩家登录到他的帐户时,这个例子在控制台中显示. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function outputOnLogin ( previous_account, current_account, auto_login ) -- | function outputOnLogin ( previous_account, current_account, auto_login ) --当玩家登陆时 | ||
outputConsole(getAccountName(previous_account).." Logged into "..getAccountName(current_account)) -- | outputConsole(getAccountName(previous_account).." Logged into "..getAccountName(current_account)) -- 在控制台上显示 | ||
end | end | ||
addEventHandler("onPlayerLogin",root,outputOnLogin ) -- | addEventHandler("onPlayerLogin",root,outputOnLogin ) --添加事件处理程序 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 03:52, 4 February 2021
此函数用于获取帐户account的名称.
语法
string getAccountName ( account theAccount )
OOP 语法 什么是OOP?
- 方法: account:getName(...)
- 变量: .name
必填函数
- theAccount: 你希望获得的帐户名称.
Returns
如果帐户不存在或传递给函数的参数无效,则返回包含帐户名“false”的字符串.
示例
当一个玩家登录到他的帐户时,这个例子在控制台中显示.
function outputOnLogin ( previous_account, current_account, auto_login ) --当玩家登陆时 outputConsole(getAccountName(previous_account).." Logged into "..getAccountName(current_account)) -- 在控制台上显示 end addEventHandler("onPlayerLogin",root,outputOnLogin ) --添加事件处理程序
See Also
- addAccount
- copyAccountData
- getAccount
- getAccountData
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccounts
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- logOut
- removeAccount
- setAccountData
- setAccountPassword
- getAccountByID
- getAccountID
- getAccountIP
- getAccountsByData
- getAccountsByIP
- setAccountName