TextItemSetText
Jump to navigation
Jump to search
Overwrites a previously created text item with the specified text.
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", getRootElement(), "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
- textCreateDisplay
- textCreateTextItem
- textDestroyDisplay
- textDestroyTextItem
- textDisplayAddObserver
- textDisplayAddText
- textDisplayGetObservers
- textDisplayIsObserver
- textDisplayRemoveObserver
- textDisplayRemoveText
- textItemGetColor
- textItemGetPosition
- textItemGetPriority
- textItemGetScale
- textItemGetText
- textItemSetColor
- textItemSetPosition
- textItemSetPriority
- textItemSetScale
- textItemSetText