TextDisplayAddObserver: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 13: Line 13:
==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function MyTestTextFunction ()
display = textCreateDisplay ()                -- create a new display, store the reference in a variable called display
display = textCreateDisplay ()                -- create a new display, store the reference in a variable called display
textDisplayAddObserver ( display, thePlayer )  -- add an observer to it
textDisplayAddObserver ( display, thePlayer )  -- add an observer to it
text = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 ) -- create a text item
text = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 ) -- create a text item
textDisplayAddText ( display, text )          -- Add the text item to the text display
textDisplayAddText ( display, text )          -- Add the text item to the text display
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Text functions}}
{{Text functions}}

Revision as of 18:28, 7 October 2008

This function adds a player as an observer of a textdisplay. This allows the player to see any textitems that the textdisplay contains.

Syntax

void textDisplayAddObserver ( textdisplay display, player playerToAdd )

Required Arguments

Example

function MyTestTextFunction ()
display = textCreateDisplay ()                 -- create a new display, store the reference in a variable called display
textDisplayAddObserver ( display, thePlayer )  -- add an observer to it
text = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 ) -- create a text item
textDisplayAddText ( display, text )           -- Add the text item to the text display
end

See Also