Code Monkey home page Code Monkey logo

altv-os-nametags's Introduction

Open Source - Nametags

❤️ 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

This repository provides a simple nametag system with optional health bars and armour bars. As well as hiding nametags when players are inside of vehicles. This nametag system scales based on distance as well as checks if you have direct line of sight with the opposing players.

Nametags can be toggled completely off or on for a single player.

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

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

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

Ensure your package.json includes this property:

"type": "module"

Adding Custom Names to Players

The custom names are automatically synced once you set the synced meta. However, they will not show until you set a configuration on the player.

Example

alt.on('playerConnect', player => {
    player.setSyncedMeta('NAME', 'Johnny_Delgado');
});

Configuring Player's Nametags

Setting the configuration takes the following properties.

Argument Description
player Pass the alt.Player from any event.
showNameTags Let the player draw all nametags of all players locally.
hideNamesInVehicles Hide the nametags of players in vehicles if you're not in their vehicle.
showBarsOnAim Show Health and Armour Bars when you are aiming at a player.
maxDrawDistance Set the maximum draw distance for nametags. Default: 100

Example

alt.on('playerConnect', player => {
    player.setSyncedMeta('NAME', 'Johnny_Delgado');
    alt.emit('nametags:Config', player, true, false, true, 100);
});

Other alt:V Open Source Resources

altv-os-nametags's People

Contributors

basarus avatar ravenous47 avatar stuyk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

altv-os-nametags's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.