GetAccountClient: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function is | 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== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
client getAccountClient ( account theAccount ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''theAccount:''' The account you wish to get the client of. | ||
===Returns=== | ===Returns=== | ||
Returns | Returns a [[client]] element if the account is currently in use, ''false'' otherwise. | ||
==Example== | ==Example== | ||
This example | This example sees 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 ) | ||
local theClient = getAccountClient ( theAccount ) -- get the client attached to the account | |||
-- | if ( getElementType ( theClient ) == "player" ) then -- see if its a player (rather than an admin for example) | ||
if ( getPlayerHealth ( theClient ) > 0 ) then -- if the player's health is greater than 0 | |||
return true | |||
end | |||
end | |||
return false | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{ | {{Account_functions}} |
Revision as of 10:04, 12 September 2006
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 sees 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 its a player (rather than an admin for example) if ( getPlayerHealth ( theClient ) > 0 ) 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