ZH-CN/GetAccountPlayer: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Добавление языков)
 
Line 29: Line 29:
{{Account functions}}
{{Account functions}}


[[en:getAccountPlayer]]
[[ru:getAccountPlayer]]
[[ru:getAccountPlayer]]
[[ar:getAccountPlayer]]
[[ar:getAccountPlayer]]
[[pl:GetAccountPlayer]]
[[pl:GetAccountPlayer]]
[[en: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