Appearance
Caution
The client-side natives and server-side API is only usable on the freemode (mp_m_freemode_01
for male and mp_f_freemode_01
for female) models. The synchronization of client-size set appearance is valid until the first time a server-side setter is used. To realize the client-size preview of ped appearance it is recommended to clone the player's ped and set the appearance with the natives previously enumerated.
Tip
Only the tatoos (native addPedDecorationFromHashes) have still to be set client-side and is synced even if you use the new Appearance API / Clothes API server-side.
Starting with the alt:V 7.0 release, you are now able set a player appearance server-side, here is a summary of the new methods and their corresponding natives client-side if they have one.
Usage
HeadBlendData
Warning
Once you set the player model you must use this method in order to make the other methods work
The "shape" parameters control the shape of the ped's face. The "skin" parameters control the skin tone. ShapeMix and skinMix control how much the first and second IDs contribute (typically mother and father), ThirdMix overrides the others in favor of the third IDs. IsParent is set for "children" of the player character's grandparents during old-gen character creation. It has unknown effect otherwise.
The IDs start at zero and go Male Non-DLC, Female Non-DLC, Male DLC and Female DLC. more informations here
Set head blend data native
import * as native from 'natives';
import * as alt from 'alt-client';
const ped = alt.Player.local;
const shapeFirstID = 0;
const shapeSecondID = 0;
const shapeThirdID = 0;
const skinFirstID = 0;
const skinSecondID = 0;
const skinThirdID = 0;
const shapeMix = 0;
const skinMix = 0;
const thirdMix = 0;
const isParent = false;
native.setPedHeadBlendData(ped, shapeFirstID, shapeSecondID, shapeThirdID, skinFirstID, skinSecondID, skinThirdID, shapeMix, skinMix, thirdMix, isParent);
Head blend palette color
Id ranges from 0 to 3.
To set head blend palette color native
import * as native from 'natives';
import * as alt from 'alt-client';
const ped = alt.Player.local;
const color = new alt.RGBA(100, 150, 200);
const red = color.r;
const green = color.g;
const blue = color.b;
const id = 0;
native.setHeadBlendPaletteColor(ped, r, g, b, id);
Face feature (micro morph)
Index ranges from 0 to 19. e.g. nose length, chin shape. Scale ranges from -1.0 to 1.0.
To set face feature native
import * as native from 'natives';
import * as alt from 'alt-client';
const ped = alt.Player.local;
const index = 0;
const scale = 0.5;
native.setPedMicroMorph(ped, index, scale);
Head overlay
OverlayID ranges from 0 to 12. eg. Blemishes, Facial hair. Index goes from 0 to getPedHeadOverlayNum - 1. opacity goes from 0.0 to 1.0.
To set head overlay native
import * as native from 'natives';
import * as alt from 'alt-client';
const ped = alt.Player.local;
const overlayID = 0;
const index = 0;
const opacity = 0.5;
native.setPedHeadOverlay(ped, overlayID, index, opacity);
To get head overlay native
import * as native from 'natives';
import * as alt from 'alt-client';
const ped = alt.Player.local;
const overlayID = 0;
native.getPedHeadOverlay(ped, overlayID);
HeadOverlayColor
ColorType is 1 for eyebrows, beards, and chest hair ColorType is 2 for blush and lipstick ColorType is 0 otherwise.
To set head overlay color native
import * as native from 'natives';
import * as alt from 'alt-client';
const ped = alt.Player.local;
const overlayID = 0;
const colorType = 0;
const colorID = 0;
const secondColorID = 0;
native.setPedHeadOverlayTint(ped, overlayID, colorType, colorID, secondColorID);
Eye color
Recommended eye color indexes range is from 1 to 31.
To set eye color native
import * as native from 'natives';
import * as alt from 'alt-client';
const ped = alt.Player.local;
const index = 0;
native.setHeadBlendEyeColor(ped, index);
To get eye color native
import * as native from 'natives';
import * as alt from 'alt-client';
const ped = alt.Player.local;
native.getHeadBlendEyeColor(ped);
Hair color
To set hair color native
import * as native from 'natives';
import * as alt from 'alt-client';
const ped = alt.Player.local;
const colorID = 0;
const highlightColorID = 0;
native.setPedHairTint(ped, colorID, highlightColorID);
Troubleshooting
If you combine the client-side and server-side function to set appearance, sooner or later you will encounter error messages in your server console.
When it happens, you must track and remove the client-side functions where you set players appearance in order to remove those logs.