ZH-CN/logOut: Difference between revisions
Jump to navigation
Jump to search
Qwe7769611 (talk | contribs) (Created page with "__NOTOC__ {{Server function}} This function logs the given player out of his current account. ==Syntax== <syntaxhighlight lang="lua"> bool logOut ( player thePlayer ) <...") |
m (Добавление языков) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
此函数用于将给定的玩家从其当前[[帐户]]中注销. | |||
== | ==语法== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool logOut ( player thePlayer ) | bool logOut ( player thePlayer ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | {{OOP_ZH-CN||[[player]]:logOut}} | ||
=== | ===必填参数=== | ||
*'''thePlayer:''' | *'''thePlayer:''' 要注销的玩家账户 | ||
=== | ===返回值=== | ||
如果玩家成功注销,则返回“true”;如果由于某种原因失败,则返回“false”或“nil”,即玩家从未登录 | |||
== | ==示例== | ||
此示例在资源(重新)启动时将每个玩家从其帐户中注销。这对于在onClientResourceStart上显示登录屏幕的资源来说非常方便 | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function logoutAll () | function logoutAll () | ||
Line 27: | Line 27: | ||
end | end | ||
end | end | ||
-- | -- 当资源(重新)启动时触发它 | ||
addEventHandler ( "onResourceStart", getResourceRootElement(), logoutAll )</syntaxhighlight> | addEventHandler ( "onResourceStart", getResourceRootElement(), logoutAll )</syntaxhighlight> | ||
Line 33: | Line 33: | ||
{{Account_functions}} | {{Account_functions}} | ||
[[en:logOut]] | |||
[[ru:logOut]] | [[ru:logOut]] | ||
[[es:logOut]] | [[es:logOut]] | ||
[[zh-cn:logOut]] | [[zh-cn:logOut]] |
Latest revision as of 15:07, 12 April 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
- addAccount
- copyAccountData
- getAccount
- getAccountData
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccounts
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- logOut
- removeAccount
- setAccountData
- setAccountPassword
- getAccountByID
- getAccountID
- getAccountIP
- getAccountsByData
- getAccountsByIP
- setAccountName