SetPlayerNametagShowing: Difference between revisions

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


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This script will turn off player tags for everyone
This example does...
<!-- 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...
root = getRootElement ()
blabhalbalhb --abababa
players = {}
--This line does this...
--Make a players varible and define it as a table
mooo
players = getElementsByType ( "player" )
--Store all the players in the server into the table
 
addEventHandler ( "onResourceStart", root, "ResourceStart" )
function ResourceStart ( name, root )
for k,v in players do
--for all the players in the table
setPlayerNametagShowing ( v, false )
--turn off their nametag
end
end
 
addEventHandler ( "onPlayerJoin", root, "PlayerJoin" )
function PlayerJoin ()
setPlayerNametagShowing ( v, false )
--Whoever joins the server should also have their nametags deactivated
end
 
</syntaxhighlight>
</syntaxhighlight>



Revision as of 01:35, 11 April 2007

This fake function is for use with blah & blah and does blahblahblabhalbhl

Syntax

bool setPlayerNametagShowing ( player thePlayer, bool showing )

Required Arguments

  • argumentName: description

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • argumentName2: description
  • argumentName3: description

Returns

Returns true if blah, false otherwise.

Example

This script will turn off player tags for everyone

root = getRootElement ()
players = {}
--Make a players varible and define it as a table
players = getElementsByType ( "player" )
--Store all the players in the server into the table

addEventHandler ( "onResourceStart", root, "ResourceStart" )
function ResourceStart ( name, root )
	for k,v in players do
	--for all the players in the table
	setPlayerNametagShowing ( v, false )
	--turn off their nametag
	end
end

addEventHandler ( "onPlayerJoin", root, "PlayerJoin" )
function PlayerJoin ()
	setPlayerNametagShowing ( v, false )
	--Whoever joins the server should also have their nametags deactivated
end

See Also

Template:FunctionArea functions -- leave this unless you complete the function