About This File
This resource adds hair overlays/hair tattoos/hair decals for freemode male and freemode female. Hair overlays are used in GTA Online for better looking hair.
Requirements
- RAGE Multiplayer 1.1 and above
- mp.game.data resource
- Some script editing
Installing
- Put the files you downloaded in their respective places
- Install mp.game.data if you haven't installed it yet
- Add require('hair-overlay') to client_packages/index.js
- All done
Clientside API
/** * Call after updating the local player's hair style on clientside. * Useful for barber shop preview and other customization related scripts. */ mp.players.local.applyHairOverlay();
Serverside API
/** * Call after updating a player's hair style on serverside. * Not using this function might cause visual desync until the player is restreamed in to other players. */ player.applyHairOverlay();
Example
Commands used during development:
// Clientside (https://rage.mp/files/file/296-better-clientside-commands/ - for addCommand clientside) // /client_sethair 72 0 0 mp.events.addCommand("client_sethair", (hair, color, highlight) => { hair = Number(hair); color = Number(color); highlight = Number(highlight); mp.players.local.setComponentVariation(2, hair, 0, 2); mp.players.local.setHairColor(color, highlight); mp.players.local.applyHairOverlay(); }); // Serverside // /sethair 72 0 0 mp.events.addCommand("sethair", (player, _, hair, color, highlight) => { hair = Number(hair); color = Number(color); highlight = Number(highlight); player.setClothes(2, hair, 0, 2); player.setHairColor(color, highlight); player.applyHairOverlay(); });
Notes
- Streamed in freemode male/freemode female players will always receive a hair overlay, meaning no more 100% bald characters.
- Local player won't have a hair overlay until applyHairOverlay function is used. (either locally or from serverside)
- clearFacialDecorations function is used to remove the old hair overlay on clientside. Meaning if you have other scripts that use setFacialDecoration, applied facial decoration(s) will be removed after a hair overlay change.
- Hair overlays are retrieved from the game, the problem with this approach is earlier hair styles (drawable 1 to 20? something like that) for both freemode male/freemode female lacks decal information which causes the resource to apply the fallback/default hair overlay. (fm_hair_fuzz)
- Unless they have forced component information (check mp_m_freemode_01_gunrunning_hair_shop.meta for forced decal component example), third party hair styles will apply the fallback/default hair overlay. (fm_hair_fuzz)
- Also on GitHub: https://github.com/root-cause/ragemp-hair-overlays
Edited by rootcause