ZH-CN/logOut

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

此函数用于将给定的玩家从其当前帐户中注销.

语法

bool logOut ( player thePlayer )

OOP 语法 什么是OOP?

方法: player:logOut(...)

必填参数

  • thePlayer: 要注销的玩家账户

返回值

如果玩家成功注销,则返回“true”;如果由于某种原因失败,则返回“false”或“nil”,即玩家从未登录

示例

此示例在资源(重新)启动时将每个玩家从其帐户中注销。这对于在onClientResourceStart上显示登录屏幕的资源来说非常方便

function logoutAll ()
	local players = getElementsByType ( "player" ) -- Get every player
		for k, player in ipairs ( players ) do -- For every player do the following...
			account = getPlayerAccount ( player ) -- Get every player's account
				if ( not isGuestAccount ( account ) ) then -- For every player that's logged in....
					logOut ( player ) -- Log them out.
				end
		end
end
 -- 当资源(重新)启动时触发它
addEventHandler ( "onResourceStart", getResourceRootElement(), logoutAll )

See Also