textItemGetText | Multi Theft Auto: Wiki Skip to content

textItemGetText

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.


This function returns the current text of the specified textitem.

Syntax

textItemGetText ( )

Code Examples

server

Increment a score display. In real scripts it's of course better to keep a global 'score' variable which can be incremented directly.

function givePoint ( thePlayer )
local scoretextitem = scoretextitems[thePlayer] -- find the score text item that belongs to this player
local score = textItemGetText ( scoretextitem ) -- read the text (a score number)
score = tostring(tonumber(score) + 1) -- convert to number, add 1, convert to text
textItemSetText ( scoretextitem, score ) -- put the new score on the text item
end