GetPlayerUserName: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 30: | Line 30: | ||
if ( sourcePlayer ) then | if ( sourcePlayer ) then | ||
local mtaaccount = getPlayerUserName( sourcePlayer ) | local mtaaccount = getPlayerUserName( sourcePlayer ) | ||
if( mtaaccount ) then | if ( mtaaccount ) then | ||
outputChatBox("Your community.mtasa.com account is " .. mtaaccount, sourcePlayer ) | outputChatBox("Your community.mtasa.com account is " .. mtaaccount, sourcePlayer ) | ||
else | else | ||
Line 40: | Line 40: | ||
-- register outputMTAAccount as a handler for the mta-account command | -- register outputMTAAccount as a handler for the mta-account command | ||
addCommandHandler ( " | addCommandHandler ( "mtaaccount", outputMTAAccount ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
==See Also== | ==See Also== | ||
{{Serial functions}} | {{Serial functions}} |
Revision as of 06:35, 17 July 2009
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 local player's MTA account 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 ( "mtaaccount", outputMTAAccount )