CreateTextBox: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
<syntaxhighlight lang="Lua> | <syntaxhighlight lang="Lua> | ||
-- client side | -- client side | ||
CashText = 0 | CashText = 0 | ||
Line 23: | Line 22: | ||
SetTextBoxAnchors(CashText, 1.0, 0.0, 1.0, 0.0) | SetTextBoxAnchors(CashText, 1.0, 0.0, 1.0, 0.0) | ||
SetTextBoxAlignment(CashText, 1.0, 0.0) | SetTextBoxAlignment(CashText, 1.0, 0.0) | ||
end | end) | ||
AddEvent("OnPackageStop", function() | |||
DestroyTextBox(CashText) | |||
end) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{Template:TextFunctions}} | {{Template:TextFunctions}} |
Latest revision as of 13:03, 20 November 2019
Description
Creates a text box on the player's screen.
Syntax
CreateTextBox(x, y, text, justification)
Parameters
- x
The screen X axis - y
The screen Y axis - text
The text you want - justification
Valid options as string: left (default), center, right
Return Value
- Returns the identifier to the new text box.
Example
-- client side
CashText = 0
AddEvent("OnPackageStart", function()
CashText = CreateTextBox(-15, 180, 'CASH', "right")
SetTextBoxAnchors(CashText, 1.0, 0.0, 1.0, 0.0)
SetTextBoxAlignment(CashText, 1.0, 0.0)
end)
AddEvent("OnPackageStop", function()
DestroyTextBox(CashText)
end)