TextItemSetText

From Multi Theft Auto: Wiki
Revision as of 20:24, 20 May 2006 by Ransom (talk | contribs)
Jump to navigation Jump to search

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

See Also

Template:Text Functions