/altv-os-global-textlabels

Global Text Labels with a simple interface to display information in-game.

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Open Source - Global Text Labels - alt:V

❤️ Become a Sponsor of my Open Source Work

⌨️ Learn how to script for alt:V

💡 Need a Roleplay Script? Try Athena!

⭐ This repository if you found it useful!


Description

Easily create global text labels with custom color, font, scale, and distance. Text Labels are automatically synchronized when a player joins the server.

Keep in mind that these are globally seen by all players.

Installing Dependencies / Installation

I cannot stress this enough. Ensure you have NodeJS 13+ or you will have problems.

  • NodeJS 13+
  • An Existing or New Gamemode
  • General Scripting Knowledge

After simply add the name of this resource to your server.cfg resource section.

altv-os-global-textlabels

Then simply clone this repository into your main server resources folder.

cd resources
git clone https://github.com/Stuyk/altv-os-global-textlabels

Ensure your package.json includes this property:

"type": "module"

Creating a Text Label

Uses the event called 'textLabel:Create'

Parameter Description
identifier Unique string to associate with the label.
text The text to display in the label.
position A Vector3 or position to place it.
distance Distance before it draws for a player.
fontType 0,1,2,4, and 7
scale Size of the text. Recommend: 0.4
red 0-255
green 0-255
blue 0-255
alpha 0-255

Example

alt.emit(
    'textLabel:Create',
    'label2',
    'Testing',
    {
        x: -1303.6351318359375,
        y: 153.87692260742188,
        z: 58.160400390625
    },
    5,
    2,
    0.4,
    255,
    255,
    255,
    100
);

Destroy a Text Label

If you ever need to destroy the label you have created during the runtime you can simply call textLabel:Destroy.

Parameter Description
identifier Unique string to associate with the label.

Example

alt.emit('textLabel:Destroy', 'label2');

Other alt:V Open Source Resources