Label::text: Difference between revisions

From RAGE Multiplayer Wiki
(Updated example to specify it's for serverside)
m (Replaced HTML with template)
 
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.


<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
{{ServersideCode|
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<pre>
<syntaxhighlight lang="javascript">
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 26: Line 25:
     player.outputChatBox("Label Updated");
     player.outputChatBox("Label Updated");
});
});
</syntaxhighlight>
</pre>
</div>
}}


== 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