SetPlayerNametagText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Needs_Checking|Read my description. This function seems kinda silly if its only going to change the text of the tag inside the world on the player. --[[User:Ransom|Ransom]] 21:58, 10 April 2007 (CDT)}}
__NOTOC__  
__NOTOC__  
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
This fake function is for use with blah & blah and does blahblahblabhalbhl
This will change the text of a player's nickname in the world to something besides the nickname he choose. This will not change the player's actual nickname, except for the visible aspect inside the GTA world (you will see his original nickname in the scoreboard and will refer to his original name in scripts).


==Syntax==  
==Syntax==  
Line 11: Line 13:
===Required Arguments===  
===Required Arguments===  
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
*'''argumentName:''' description
*'''thePlayer:''' The player whose nickname text you wish to change
 
*'''text:''' The new nickname text that will be displayed
<!-- Only include this section below if there are optional arguments -->
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' description
*'''argumentName3:''' description


===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns ''true'' if blah, ''false'' otherwise.
Returns ''true'' if successful, ''false'' otherwise.


==Example==  
==Example==  
Line 28: Line 25:
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
addCommandHandler ( "lamer", "ihatelamers" )
blabhalbalhb --abababa
function ihatelamers ( player, commandName, playername )
--This line does this...
--This is a command handler that activates on text "lamer" followed by the playername
mooo
--in the console. The playername argument was added as an extra varible to store the
--name of the player whose text will be changed.
if playername == false then
--Prevents the command from running if the player did not specify a value for playername
outputChatBox ( "You MUST define a player to change his name tag!" )
else
culprit = getPlayerFromNick ( playername )
--This varible stores the result of trying to find the player associated with the playername
--that the user of the command specified
if culprit ~= false then
--This checks to make sure a player nick was found. If it was not then the playername argument
--specified by the command user was not equivalent to the name of any players in the server
setPlayerNametagText ( culprit, "IM_LAME" )
--finally, the nickname text is changed since the command arguments were checked and are valid
else
outputChatBox ( "Player does not exist!" )
end
end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{FunctionArea_functions}}
{{Player_functions}}
[[Category:Incomplete]] -- leave this unless you complete the function
[[Category:Incomplete]] -- leave this unless you complete the function

Revision as of 02:58, 11 April 2007

Dialog-information.png This article needs checking.

Reason(s): Read my description. This function seems kinda silly if its only going to change the text of the tag inside the world on the player. --Ransom 21:58, 10 April 2007 (CDT)


This will change the text of a player's nickname in the world to something besides the nickname he choose. This will not change the player's actual nickname, except for the visible aspect inside the GTA world (you will see his original nickname in the scoreboard and will refer to his original name in scripts).

Syntax

bool setPlayerNametagText ( player thePlayer, string text )

Required Arguments

  • thePlayer: The player whose nickname text you wish to change
  • text: The new nickname text that will be displayed

Returns

Returns true if successful, false otherwise.

Example

This example does...

addCommandHandler ( "lamer", "ihatelamers" )
function ihatelamers ( player, commandName, playername )
--This is a command handler that activates on text "lamer" followed by the playername
--in the console. The playername argument was added as an extra varible to store the
--name of the player whose text will be changed.
 	if playername == false then
 	--Prevents the command from running if the player did not specify a value for playername
	outputChatBox ( "You MUST define a player to change his name tag!" )
	else
	culprit = getPlayerFromNick ( playername )
	--This varible stores the result of trying to find the player associated with the playername
	--that the user of the command specified
		if culprit ~= false then
		--This checks to make sure a player nick was found. If it was not then the playername argument
		--specified by the command user was not equivalent to the name of any players in the server
		setPlayerNametagText ( culprit, "IM_LAME" )
		--finally, the nickname text is changed since the command arguments were checked and are valid
		else
		outputChatBox ( "Player does not exist!" )
		end
	end
end

See Also

-- leave this unless you complete the function