ZH-CN/GetAccountPlayer: Difference between revisions
Jump to navigation
Jump to search
Qwe7769611 (talk | contribs) (Created page with "__NOTOC__ {{Server function}} This function returns the player element that is currently using a specified account, i.e. is logged into it. Only one player can use an...") |
m (Добавление языков) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
{{Server function}} | {{Server function}} | ||
此函数返回当前正在使用指定账户[[account]]的玩家[[player]]元素,即已登录到该元素,一次只能有一个玩家使用一个帐号. | |||
== | ==语法== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
player getAccountPlayer ( account theAccount ) | player getAccountPlayer ( account theAccount ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | {{OOP_ZH-CN||[[account]]:getPlayer|player|}} | ||
=== | ===必填函数=== | ||
*'''theAccount:''' | *'''theAccount:''' 您希望获得玩家[[player]]的那个账户[[account]]. | ||
=== | ===返回值=== | ||
如果帐户当前在线,则返回玩家[[player]]元素,否则返回“false”. | |||
== | ==示例== | ||
此示例检查附加到帐户的用户是否是玩家,如果是,是否还活着. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function isAccountUserAlive ( theAccount ) | function isAccountUserAlive ( theAccount ) | ||
local thePlayer = getAccountPlayer ( theAccount ) -- | local thePlayer = getAccountPlayer ( theAccount ) -- 将客户端添加到帐户 | ||
if ( getElementType ( thePlayer ) == "player" ) then -- | if ( getElementType ( thePlayer ) == "player" ) then -- 看看它是否真的是一个玩家(而不是一个控制台管理员的例子) | ||
return not isPedDead(thePlayer) -- | return not isPedDead(thePlayer) -- 如果玩家生命值大于0 | ||
end | end | ||
return false | return false | ||
Line 29: | Line 29: | ||
{{Account functions}} | {{Account functions}} | ||
[[en:getAccountPlayer]] | |||
[[ru:getAccountPlayer]] | [[ru:getAccountPlayer]] | ||
[[ar:getAccountPlayer]] | [[ar:getAccountPlayer]] | ||
[[pl:GetAccountPlayer]] | [[pl:GetAccountPlayer]] | ||
[[zh-cn:GetAccountPlayer]] | [[zh-cn:GetAccountPlayer]] |
Latest revision as of 13:03, 12 April 2021
此函数返回当前正在使用指定账户account的玩家player元素,即已登录到该元素,一次只能有一个玩家使用一个帐号.
语法
player getAccountPlayer ( account theAccount )
OOP 语法 什么是OOP?
- 方法: account:getPlayer(...)
- 变量: .player
必填函数
返回值
如果帐户当前在线,则返回玩家player元素,否则返回“false”.
示例
此示例检查附加到帐户的用户是否是玩家,如果是,是否还活着.
function isAccountUserAlive ( theAccount ) local thePlayer = getAccountPlayer ( theAccount ) -- 将客户端添加到帐户 if ( getElementType ( thePlayer ) == "player" ) then -- 看看它是否真的是一个玩家(而不是一个控制台管理员的例子) return not isPedDead(thePlayer) -- 如果玩家生命值大于0 end return false end
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