Weapon Tint Sync 1.0.0

   (3 reviews)
Sign in to follow this  

2 Screenshots

About This File

This resource provides serverside weapon tint API for developers and syncs applied weapon tints.

 

Installing

  • Put the files you downloaded in their respective places
  • Add require('weapontints') to client_packages/index.js
  • All done

 

Serverside API

PRO TIP: Check RAGEMP Wiki for tints.

/**
 * Sets the tint of the player's specified weapon.
 * @param {Number} weaponHash The weapon hash.
 * @param {Number} tintIndex  The tint index.
 * @throws {TypeError} If any of the arguments is not a number.
 */
player.setWeaponTint(weaponHash, tintIndex);

/**
 * Gets the tint of the player's specified weapon.
 * @param  {Number} weaponHash The weapon hash.
 * @returns {Number}           Tint of the specified weapon.
 * @throws {TypeError} If weaponHash argument is not a number.
 */
player.getWeaponTint(weaponHash);

/**
 * Returns an object that contains all weapon tints of the player. Key: weapon hash | Value: tint index
 * @returns {Object}
 */
player.getAllWeaponTints();

/**
 * Resets tints of the player's all weapons.
 */
player.resetAllWeaponTints();

 

Example Commands

These are the commands I used while testing this script.

// Example: /settint carbinerifle 3
mp.events.addCommand("settint", (player, _, weapon, tint) => {
    weapon = mp.joaat(`weapon_${weapon}`);
    tint = Number(tint);

    player.setWeaponTint(weapon, tint);
});

// Example: /gettint carbinerifle
mp.events.addCommand("gettint", (player, _, weapon) => {
    const weaponHash = mp.joaat(`weapon_${weapon}`);
    player.outputChatBox(`Tint of ${weapon}: ${player.getWeaponTint(weaponHash)}`);
});

mp.events.addCommand("resettints", (player) => {
    player.resetAllWeaponTints();
});

 

Notes

  1. If there are any reproducible bugs, feel free to report them.
  2. This resource will be obsolete after 0.4's weapon attachment/customization API arrives.
  • Like 2



User Feedback

Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now