ZH-CN/logOut: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 12: Line 12:
*'''thePlayer:''' 要注销的玩家账户
*'''thePlayer:''' 要注销的玩家账户


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


Line 35: Line 35:
[[ru:logOut]]
[[ru:logOut]]
[[es:logOut]]
[[es:logOut]]
[[zh-cn:logOut]]
[[en:logOut]]

Revision as of 07:01, 5 February 2021

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

语法

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