GetAccountClient: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Changed "DeprecatedWithAlt" template to "Deprecated") |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | |||
{{Deprecated|getAccountPlayer|}} | |||
This function returns the client that is currently using a specified account, i.e. is logged into it. Only one client can use an account at a time. | This function returns the client that is currently using a specified account, i.e. is logged into it. Only one client can use an account at a time. | ||
==Syntax== | ==Syntax== | ||
Line 13: | Line 16: | ||
==Example== | ==Example== | ||
This example | This example checks if the user attached to an account is a player, and if so if they're alive. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function isAccountUserAlive ( theAccount ) | function isAccountUserAlive ( theAccount ) | ||
local theClient = getAccountClient ( theAccount ) -- get the client attached to the account | local theClient = getAccountClient ( theAccount ) -- get the client attached to the account | ||
if ( getElementType ( theClient ) == "player" ) then -- see if | if ( getElementType ( theClient ) == "player" ) then -- see if it's a player (rather than an admin for example) | ||
if ( | if ( not isPlayerDead ( theClient ) ) then -- if the player's health is greater than 0 | ||
return true | return true | ||
end | end |
Latest revision as of 16:21, 13 February 2015
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. | |
Please use getAccountPlayer instead. |
This function returns the client that is currently using a specified account, i.e. is logged into it. Only one client can use an account at a time.
Syntax
client getAccountClient ( account theAccount )
Required Arguments
- theAccount: The account you wish to get the client of.
Returns
Returns a client element if the account is currently in use, false otherwise.
Example
This example checks if the user attached to an account is a player, and if so if they're alive.
function isAccountUserAlive ( theAccount ) local theClient = getAccountClient ( theAccount ) -- get the client attached to the account if ( getElementType ( theClient ) == "player" ) then -- see if it's a player (rather than an admin for example) if ( not isPlayerDead ( theClient ) ) then -- if the player's health is greater than 0 return true end end return false end
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