GetPlayerUserName: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
|||
Line 24: | Line 24: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function outputMTAAccount ( sourcePlayer ) | function outputMTAAccount ( sourcePlayer ) | ||
Line 40: | Line 41: | ||
-- register outputMTAAccount as a handler for the mta-account command | -- register outputMTAAccount as a handler for the mta-account command | ||
addCommandHandler ( "mta-account", outputMTAAccount ) | addCommandHandler ( "mta-account", outputMTAAccount ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> |
Revision as of 21:13, 5 February 2008
This function returns the community.mtasa.com (or mtabeta.com)-Account of the specified user.
Syntax
Click to collapse [-]
Serverstring 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 [-]
Clientstring getPlayerUserName ()
Returns
A string value containing the local MTA accounts username or false if no account exists for the local player.
Example
Click to collapse [-]
Serverfunction 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 )