GetClientName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Visual improvement)
m (Changed "DeprecatedWithAlt" template to "Deprecated")
 
Line 1: Line 1:
__NOTOC__
{{Server function}}
{{Server function}}
{{DeprecatedWithAlt|getPlayerName|}}
{{Deprecated|getPlayerName|}}
__NOTOC__


This function gets a [[client]]'s name (a client can either be a [[player]] or an admin).
This function gets a [[client]]'s name (a client can either be a [[player]] or an admin).

Latest revision as of 16:17, 13 February 2015

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getPlayerName instead.


This function gets a client's name (a client can either be a player or an admin).

Syntax

string getClientName ( client theClient )

Required Arguments

  • theClient: the client element (player or admin) you want to get the name of.

Returns

Returns a string containing the requested client's name, or false if the client passed to the function is invalid.

Example

This example adds a tag before a player's nick.

function tagPlayer( thePlayer, tag )
	--we check thePlayer is a player, otherwise this function could be used with admins
	if getElementType(thePlayer) == "player" then
		--we store the player's current name,
		local oldName = getClientName( thePlayer )
		--append the tag passed to this function before it,
		local taggedName = tag .. oldName
		--then set it as his new name
		setClientName( thePlayer, taggedName )
	end
end

See Also

BEFORE VERSION 1.0 :