getAccountPlayer
Client-side
Server-side
Shared
This function returns the player element that is currently using a specified account, i.e. is logged into it. Only one player can use an account at a time.
OOP Syntax Help! I don't understand this!
- Method: account:getPlayer(...)
- Variable: .player
Syntax
player|false getAccountPlayer ( account theAccount )
Required Arguments
- theAccount: The account you wish to get the player of.
Returns
- player|false: account's player
Returns a player element if the account is currently in use, false otherwise.
Code Examples
server
This example checks if the user attached to an account is a player, and if so if they're alive.
local function isAccountUserAlive ( theAccount ) local thePlayer = getAccountPlayer ( theAccount ) -- get the client attached to the account if ( getElementType ( thePlayer ) == "player" ) then -- see if it really is a player (rather than a console admin for example) return not isPedDead(thePlayer) -- if the player's health is greater than 0 end return falseend
See Also
Account Functions
- addAccount
- copyAccountData
- getAccountByID
- getAccount
- getAccountData
- getAccountID
- getAccountIP
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccountType
- getAccounts
- getAccountsByData
- getAccountsByIP
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- removeAccount
- logOut
- setAccountData
- setAccountName
- setAccountPassword
- setAccountSerial