TextDisplayRemoveText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (Changed argument order)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Server function}}
==Description==
This function removes a [[textitem]] from a [[textdisplay]]. This stops any observers of the [[textdisplay]] from being able to see the [[textitem]].
This function removes a [[textitem]] from a [[textdisplay]]. This stops any observers of the [[textdisplay]] from being able to see the [[textitem]].


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void textDisplayRemoveText ( textitem itemToRemove, textdisplay displayToRemoveFrom )
void textDisplayRemoveText ( textdisplay displayToRemoveFrom, textitem itemToRemove )
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===
===Required Arguments===
* '''displayToRemoveFrom''': The [[textdisplay]] to remove the [[textitem]] from.
* '''itemToRemove''': The [[textitem]] to remove from the display.
* '''itemToRemove''': The [[textitem]] to remove from the display.
* '''displayToRemoveFrom''': The [[textdisplay]] to remove the [[textitem]] from.


==Example==
==Example==
This example creates a text display and adds a "Hello World" text item to it.  It then removes that text item 5 seconds later.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Create a text display.
-- Create a text display.
Line 24: Line 24:
textDisplayAddText ( myTextDisplay, myTextItem )
textDisplayAddText ( myTextDisplay, myTextItem )
-- Remove the text item from the display
-- Remove the text item from the display
textDisplayRemoveText ( myTestDispay, myTextItem )
setTimer ( textDisplayRemoveText, 5000, 1, myTestDispay, myTextItem )
</syntaxhighlight>
</syntaxhighlight>


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

Latest revision as of 08:20, 6 July 2016

This function removes a textitem from a textdisplay. This stops any observers of the textdisplay from being able to see the textitem.

Syntax

void textDisplayRemoveText ( textdisplay displayToRemoveFrom, textitem itemToRemove )

Required Arguments

Example

This example creates a text display and adds a "Hello World" text item to it. It then removes that text item 5 seconds later.

-- Create a text display.
myTextDisplay = textCreateDisplay ( )
-- Add a player as an observer, i.e. this player will see everything added to this display
textDisplayAddObserver ( myTextDisplay, aPlayer )
-- Create a new text item with the text 'Hello World' and a priority of 'low' and colored red.
myTextItem = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 )
-- Add the newly created text item to the display
textDisplayAddText ( myTextDisplay, myTextItem )
-- Remove the text item from the display
setTimer ( textDisplayRemoveText, 5000, 1, myTestDispay, myTextItem )

See Also