TextItemSetText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
Explanation Paragraph
Updates a previously defined '''textDisplayAddText''' varible that you have created.


==Syntax==  
==Syntax==  

Revision as of 09:26, 19 May 2006

Updates a previously defined textDisplayAddText varible that you have created.

Syntax

void textItemSetText ( textitem textitem, string text )

Required Arguments

  • textitem: Equal to a varible of an already existing textDisplayAddText you previously specified
  • text: A string that the textDisplayAddText you previously created will be changed to

Example

Here, it is being used to update a scoreboard:

addEventHandler ( "onPlayerWasted", root, "onPlayerWasted")
function onPlayerWasted ( ammo, killer, weapon )
		if ( killer ~= false) then --Checks to see if anything killed the player. This can be false but it never equals true.
			if (players[getPlayerName(killer)].gang == "grove") then --If a player killed this person and they are part of the grove gang
				groveteamscore = groveteamscore + 1 --Grove gets 1 point
				textItemSetText ( scoregrove, tostring(groveteamscore) ) --Updated scoreboard Uses tostring() to change the varible to a string to satisfy the function.
			elseif (players[getPlayerName(killer)].gang == "balla") then --If a player killed this person and they are part of the balla gang				ballateamscore = ballateamscore + 1 -Ballas get 1 point
				textItemSetText ( scoreballa, tostring(ballateamscore) ) --Updated scoreboard. Uses tostring() to change the varible to a string to satisfy the function.
			end
		end
end