GetAccountPlayer: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Server function}} 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...) |
m (Edited language change) Tag: Manual revert |
||
(11 intermediate revisions by 9 users not shown) | |||
Line 7: | Line 7: | ||
player getAccountPlayer ( account theAccount ) | player getAccountPlayer ( account theAccount ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[account]]:getPlayer|player|}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theAccount:''' The [[account]] you wish to get the [[player]] of. | *'''theAccount:''' The [[account]] you wish to get the [[player]] of. | ||
Line 20: | Line 20: | ||
local thePlayer = getAccountPlayer ( theAccount ) -- get the client attached to the account | 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) | 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 | end | ||
return false | return false | ||
Line 30: | Line 28: | ||
==See Also== | ==See Also== | ||
{{Account functions}} | {{Account functions}} | ||
[[ru:getAccountPlayer]] | |||
[[ar:getAccountPlayer]] | |||
[[pl:GetAccountPlayer]] | |||
[[zh-cn:GetAccountPlayer]] |
Latest revision as of 15:17, 8 June 2022
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.
Syntax
player getAccountPlayer ( account theAccount )
OOP Syntax Help! I don't understand this!
- Method: account:getPlayer(...)
- Variable: .player
Required Arguments
Returns
Returns a player 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 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 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