Label::text: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "{{Shared}} Updates the text of a created label. == Syntax == <syntaxhighlight lang="javascript"> label.text = "Text"; </syntaxhighlight> == Examples == Updates the text of...")
 
m (Replaced HTML with template)
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
== Syntax ==
== Syntax ==


<syntaxhighlight lang="javascript">
<pre>
label.text = "Text";
String label.text
</syntaxhighlight>
</pre>


== Examples ==
== Examples ==
Updates the text of a label through a command.
Updates the text of a label through a command.


<syntaxhighlight lang="javascript">
{{ServersideCode|
<pre>
let startLabel = mp.labels.new("Use /labeltext to update me.", new mp.Vector3(-431.88, 1146.86, 327),
let startLabel = mp.labels.new("Use /labeltext to update me.", new mp.Vector3(-431.88, 1146.86, 327),
     {
     {
Line 24: Line 25:
     player.outputChatBox("Label Updated");
     player.outputChatBox("Label Updated");
});
});
</syntaxhighlight>
</pre>
}}


== See Also ==
== See Also ==
{{Label_definition}}
{{Label_definition}}

Latest revision as of 12:30, 26 October 2018

Shared

Updates the text of a created label.

Syntax

String label.text

Examples

Updates the text of a label through a command.

Server-Side
let startLabel = mp.labels.new("Use /labeltext to update me.", new mp.Vector3(-431.88, 1146.86, 327),
    {
        los: false,
        font: 1,
        drawDistance: 100,
    });

mp.events.addCommand("labeltext", (player, _, text) => {
    startLabel.text = text;
    player.outputChatBox("Label Updated");
});

See Also