LogOut: Difference between revisions
Jump to navigation
Jump to search
m (Needs example) |
(Added an example.) |
||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
This example logs every player out of their account when the resource is (re)started. This would be handy for resources that show a login scren onClientResourceStart. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function logoutAll () | |||
local players = getElementsByType ( "player" ) | |||
for k, player in ipairs ( players ) do | |||
account = getPlayerAccount ( player ) | |||
if ( not isGuestAccount ( account ) ) then | |||
logOut ( player ) | |||
end | |||
end | |||
end | |||
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), logoutAll ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 18:56, 21 February 2010
This function logs the given player out of his current account.
Syntax
bool logOut ( player thePlayer )
Required Arguments
- thePlayer: The player to log out of his current account
Returns
Returns true if the player was successfully logged out, false or nil if it failed for some reason, ie. the player was never logged in.
Example
This example logs every player out of their account when the resource is (re)started. This would be handy for resources that show a login scren onClientResourceStart.
function logoutAll () local players = getElementsByType ( "player" ) for k, player in ipairs ( players ) do account = getPlayerAccount ( player ) if ( not isGuestAccount ( account ) ) then logOut ( player ) end end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), 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