textItemSetText | Multi Theft Auto: Wiki Skip to content

textItemSetText

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


Overwrites a previously created text item with the specified text.

Syntax

textItemSetText ( )

Code Examples

server

Here, it is being used to update a scoreboard:

function updateScoreOnWasted ( ammo, killer, weapon )
if ( killer ~= false) then -- Check to see if anything killed the player
local killerTeam = getTeamName ( getPlayerTeam(killer) )
if ( killerTeam == "grove" ) then -- if a Grove player scored the kill
groveteamscore = groveteamscore + 1 -- Grove gets 1 point
textItemSetText ( scoregrove, tostring(groveteamscore) ) -- Update scoreboard.
elseif ( killerTeam == "balla" ) then -- if a Balla player scored the kill
ballateamscore = ballateamscore + 1 -- Ballas get 1 point
textItemSetText ( scoreballa, tostring(ballateamscore) ) -- Update scoreboard.
end
end
end
addEventHandler ( "onPlayerWasted", root, updateScoreOnWasted )