GetClientName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 29: Line 29:


==See Also==
==See Also==
{{Player functions}}
{{Client functions}}

Revision as of 22:13, 22 July 2006

This function returns a string containing the name of the client.

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 finds a player with an ID of 1 and if the player exists, they are killed.

-- Find the player with ID 1.
myPlayer = getPlayerFromID ( 1 )
-- If there is a player with an ID of 1 then...
if ( myPlayer ~= false ) then
	-- Try to kill the player, if it is successful then
	if ( killPlayer ( myPlayer ) ) then
		-- Tell everyone about it!
		outputServerChatBox ( "He shouldn't have had that ID. ", getClientName ( myPlayer ) , " has bitten the dust." )
	end
end

See Also

BEFORE VERSION 1.0 :