Label::Label: Difference between revisions

From RAGE Multiplayer Wiki
mNo edit summary
m (Category)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''Function''': Creates a TextLabel.
Creates a label in your world.
 
==Parameters==
*'''text''': {{RageType|String}}
*'''position''': {{RageType|Vector3}}
*'''los''': {{RageType|Boolean}}
*'''font''': {{RageType|Number}}
*'''drawDistance''': {{RageType|Number}}
*'''color''': {{RageType|[Number, Number, Number, Number]}}
*'''dimension''': {{RageType|dimension}}


==Syntax==
==Syntax==
{{ServerSide}}
{{Shared}}
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.labels.new(text, position,
mp.labels.new(text, position,
Line 22: Line 13:
});
});
</syntaxhighlight>
</syntaxhighlight>
===Parameters===
*'''<span style="font-weight:bold; color:red;">*</span>text''': {{RageType|String}}
*'''<span style="font-weight:bold; color:red;">*</span>position''': {{RageType|Vector3}}
*'''los''': {{RageType|Boolean}} - Line of Sight (Text will hide if blocked by an entity).
*'''font''': {{RageType|Number}} ([[Fonts_and_Colors#DrawText_Fonts|Font Types]])
*'''drawDistance''': {{RageType|Number}}
*'''color''': {{RageType|[Number, Number, Number, Number]}}
*'''dimension''': {{RageType|dimension}}
<span style="font-weight:bold; color:red;">*</span> = Required
== Example ==
Creates a label with the text "Welcome to Los Santos"
<syntaxhighlight lang="javascript">
mp.labels.new("Welcome to Los Santos", new mp.Vector3(-431.88, 1146.86, 327),
    {
        los: true,
        font: 1,
        drawDistance: 100,
    });
</syntaxhighlight>
Labels also supports multiple lines of text, this can be achieved using "\n".
== See Also ==
{{Label_definition}}
[[Category:Label API]]
[[Category:Shared Function]]

Latest revision as of 17:50, 16 May 2019

Creates a label in your world.

Syntax

Shared
mp.labels.new(text, position,
{
    los: los,
    font: font,
    drawDistance: drawDistance,
    color: color,
    dimension: dimension
});

Parameters

  • *text: String
  • *position: Vector3
  • los: Boolean - Line of Sight (Text will hide if blocked by an entity).
  • font: Number (Font Types)
  • drawDistance: Number
  • color: [Number, Number, Number, Number]
  • dimension: dimension

* = Required

Example

Creates a label with the text "Welcome to Los Santos"

mp.labels.new("Welcome to Los Santos", new mp.Vector3(-431.88, 1146.86, 327),
    {
        los: true,
        font: 1,
        drawDistance: 100,
    });

Labels also supports multiple lines of text, this can be achieved using "\n".

See Also