GetAccountPlayer
From Multi Theft Auto: Wiki
(Difference between revisions)
m (→Example) |
(→Example) |
||
| 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 | + | return not isPedDead(thePlayer) -- if the player's health is greater than 0 |
end | end | ||
return false | return false | ||
Revision as of 23:13, 23 December 2011
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 )
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
- getAccountPlayer
- getAccounts
- getPlayerAccount
- isGuestAccount
- logIn
- logOut
- removeAccount
- setAccountData
- setAccountPassword
FROM VERSION 1.3.1 r3775 ONWARDS