CreateTextBox: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|CreateGuiText(X, Y, text)}} {{FuncParameters}} {{FuncParam|X|__EDIT_ME__}} {{FuncParam|Y|__EDIT_ME..." |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Client|1.0}} | {{Info|Function|Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Creates a text box on the player's screen.}} | ||
{{FuncSyntax| | {{FuncSyntax|CreateTextBox(x, y, text, justification)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|X| | {{FuncParam|x|The screen X axis}} | ||
{{FuncParam| | {{FuncParam|y|The screen Y axis}} | ||
{{FuncParam| | {{FuncParam|text|The text you want}} | ||
{{FuncParam|justification|Valid options as string: left (default), center, right }} | |||
{{FuncReturnValue| | {{FuncReturnValue|Returns the identifier to the new text box.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua> | |||
-- 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) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{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)