GetPlayerUserName: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Better see also template) |
||
(7 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server client function}} | ||
This function returns the community.mtasa.com (or mtabeta.com) | {{MessageBox| | ||
bordercolorhex = FF0000 | | |||
bgcolorhex = FFBFBF | | |||
image = File:Emblem-important.png | | |||
message = This function is deprecated. This means that its use is discouraged. | | |||
subtext = MTA Community accounts were dropped in favor of [[serial|serials]] for identifying players. | | |||
}} | |||
This function returns the community.mtasa.com (or mtabeta.com) account of the specified user. | |||
==Syntax== | ==Syntax== | ||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string getPlayerUserName ( player thePlayer ) | string getPlayerUserName ( player thePlayer ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===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. | |||
</section> | |||
<section name="Client" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
string getPlayerUserName () | |||
</syntaxhighlight> | |||
===Returns=== | ===Returns=== | ||
A ''string'' value containing | A ''string'' value containing local player's MTA account username or ''false'' if no account exists for the local player. | ||
</section> | |||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function outputMTAAccount ( sourcePlayer ) | function outputMTAAccount ( sourcePlayer ) | ||
Line 20: | Line 38: | ||
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 | outputChatBox("Your community.mtasa.com account is " .. mtaaccount, sourcePlayer ) | ||
else | else | ||
outputChatBox("Can't find an account for you.", sourcePlayer ) | outputChatBox("Can't find an account for you.", sourcePlayer ) | ||
Line 30: | Line 48: | ||
-- 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> | |||
==See Also== | |||
{{Player functions}} |
Latest revision as of 17:04, 21 April 2016
This function is deprecated. This means that its use is discouraged. | |
MTA Community accounts were dropped in favor of serials for identifying players. |
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 )
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState