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...")
 
(Updated example to specify it's for serverside)
Line 12: Line 12:
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;">
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<syntaxhighlight lang="javascript">
<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 25: Line 27:
});
});
</syntaxhighlight>
</syntaxhighlight>
</div>


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

Revision as of 07:26, 31 May 2018

Shared

Updates the text of a created label.

Syntax

label.text = "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