GetPlayerUserName

From Multi Theft Auto: Wiki
Revision as of 14:49, 25 April 2011 by Arran Fortuna (talk | contribs)
Jump to navigation Jump to search


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 no longer serves any purpose.

This function returns the community.mtasa.com (or mtabeta.com) account of the specified user.

Syntax

Click to collapse [-]
Server
string getPlayerUserName ( player thePlayer )

Required Arguments

  • thePlayer: The player whose MTA account username you want to retrieve.

Returns

A string value containing the MTA account username or false if no account exists for the player.

Click to collapse [-]
Client
string getPlayerUserName ()

Returns

A string value containing local player's MTA account username or false if no account exists for the local player.

test

Example

Click to collapse [-]
Server
function outputMTAAccount ( sourcePlayer )
        -- if the command was triggered by an ingame player
        if ( sourcePlayer ) then
                local mtaaccount = getPlayerUserName( sourcePlayer )
                if ( mtaaccount ) then
                        outputChatBox("Your community.mtasa.com account is " .. mtaaccount, sourcePlayer )
                else
                        outputChatBox("Can't find an account for you.", sourcePlayer )
                end
        end
end


-- register outputMTAAccount as a handler for the mta-account command
addCommandHandler ( "mtaaccount", outputMTAAccount )

See Also