ZH-CN/GetAccountName

From Multi Theft Auto: Wiki
Revision as of 20:09, 11 April 2021 by EOFIK (talk | contribs) (Добавление языков)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

此函数用于获取帐户account的名称.

语法

string getAccountName ( account theAccount )

OOP 语法 什么是OOP?

方法: account:getName(...)
变量: .name

必填函数

  • theAccount: 你希望获得的帐户名称.

返回值

如果帐户不存在或传递给函数的参数无效,则返回包含帐户名“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