GetPlayerUserName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Server function}} This function returns the community.mtasa.com (or mtabeta.com)-Account of the specified user. ==Syntax== <syntaxhighlight lang="lua"> string getPlayerUserName( player thePlay...)
 
mNo edit summary
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string getPlayerUserName( player thePlayer )
string getPlayerUserName ( player thePlayer )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 14:57, 5 February 2008

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

Syntax

string getPlayerUserName ( player thePlayer )


Required Arguments

  • thePlayer: The Player which's MTA-Account you want to retrieve

Returns

A string value containing the MTA-Account-Name or false if there is no account with that serial existing.

Example

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 ( "mta-account", outputMTAAccount )