GetPlayerAccount: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 18: Line 18:
function viewAccount(thePlayer, command)
function viewAccount(thePlayer, command)
-- get the name of the account from thePlayer
-- get the name of the account from thePlayer
local accountName = [[getPlayerAccount]](thePlayer)  
local accountName = getPlayerAccount(thePlayer)  
-- output the message to the player
-- output the message to the player

Revision as of 17:03, 2 March 2008

Returns the accountname of the player

Syntax

int getPlayerAccount ( player thePlayer )

Required Arguments

  • thePlayer: The player you wish the retrieve the name of the account from.

Returns

Returns an string with name of the account. -- TODO -- What does it return if it isnt known?

Example

When a player types '/account' this example retrieves the player's accountname, and prints it to his screen.

function viewAccount(thePlayer, command)
	-- get the name of the account from thePlayer
	local accountName = getPlayerAccount(thePlayer) 
	
	-- output the message to the player
	outputChatBox("Your account name is " .. accountName, thePlayer)  	
end

-- add the console command
addCommandHandler("account", viewAccount)                                    

See Also