GetAccountClient: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added deprecated flag)
Line 1: Line 1:
{{Server function}}
{{Server function}}
__NOTOC__
__NOTOC__
{{Deprecated}}
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==  

Revision as of 14:08, 28 March 2009


Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be a more generic way to perform what it does.


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