Skip to content

Ped clothing and props

Use the server’s Ped methods to dress players and NPCs. Appearance is synchronized with other players and retained across streaming, ownership changes and respawns. A client-created LocalPed provides the same methods for local previews.

A component selection has four values:

  • Component selects the slot, such as PedComponent.Tops or PedComponent.Shoes.
  • Drawable selects an item in that slot.
  • Texture selects a texture variation of that item. Defaults to 0.
  • Palette selects the component palette. Defaults to 0.

Props use a prop slot, drawable and texture. For example, PedProp.Head selects hats and helmets, PedProp.Eyes selects glasses, and wrist slots are used for watches and bracelets. Available slots and items depend on the ped model.

For freemode clothing, Torso controls the arms and upper body, Undershirt selects the inner layer and Tops selects the outer top. Choose compatible values together to avoid gaps or clothing clipping through the body.

The PedComponent and PedProp enums list all slots.

Pass a player or NPC and drawable indices checked for its model. This example changes a top and a hat, using texture 0 for both:

Server
// @ts-check
/// <reference types="@revomp/types-server" />
import * as revo from 'revo-server';
/**
* @param {revo.Ped} ped A player or NPC using the outfit's model.
* @param {number} topDrawable Global drawable index verified for this model.
* @param {number} hatDrawable Global prop index verified for this model.
*/
export function applyOutfit(ped, topDrawable, hatDrawable) {
ped.setComponentVariation(revo.PedComponent.Tops, topDrawable, 0);
ped.setProp(revo.PedProp.Head, hatDrawable, 0);
}

You can set the outfit immediately after creating the ped or before spawning the player. Clients receive the selections when the ped loads, including players who join later.

Once a component selection is set, components without a stored selection use the model’s default outfit. Earlier selections in other slots are kept. For a complete outfit change, update every slot that the outfit controls, including accessories left over from the previous one.

This client example creates a male freemode preview at the supplied position and heading, then applies its clothing before the model finishes loading:

Client
// @ts-check
/// <reference types="@revomp/types-client" />
import * as revo from 'revo-client';
/**
* @param {revo.IVector3} position
* @param {number} heading Heading in radians.
* @param {number} topDrawable Global drawable index for mp_m_freemode_01.
* @param {number} hatDrawable Global prop index for mp_m_freemode_01.
*/
export function createOutfitPreview(position, heading, topDrawable, hatDrawable) {
const preview = new revo.LocalPed('mp_m_freemode_01', position, heading);
preview.dimension = revo.Player.local.dimension;
preview.setComponentVariation(revo.PedComponent.Tops, topDrawable, 0);
preview.setProp(revo.PedProp.Head, hatDrawable, 0);
return preview;
}

Use a preview with the same model as the character being dressed. These methods are available on LocalPed instances created by the calling resource. They store the selections and apply them again when the preview streams in. Call preview.destroy() when the preview closes.

For framing the preview, see Cameras and transitions.

Drawables and textures are numbered from 0. A count of N gives indices from 0 through N - 1. Texture counts belong to a specific drawable.

Query a loaded ped with the intended model. This client example returns the available tops and the texture count for each:

Client
// @ts-check
/// <reference types="@revomp/types-client" />
/// <reference types="@revomp/types-natives" />
import * as revo from 'revo-client';
import * as natives from 'natives';
/** @param {revo.LocalPed} ped */
export function getTopOptions(ped) {
if (!ped.ready) return [];
const component = revo.PedComponent.Tops;
const count = natives.getNumberOfPedDrawableVariations(ped, component);
return Array.from({ length: count }, (_, drawable) => ({
drawable,
textureCount: natives.getNumberOfPedTextureVariations(ped, component, drawable),
}));
}

Call it after entityStreamIn or when ready is true. The readiness check is needed for the native queries. The appearance setters can store selections before stream-in.

For props, use natives.getNumberOfPedPropDrawableVariations(ped, prop) and natives.getNumberOfPedPropTextureVariations(ped, prop, drawable). For components, natives.isPedComponentVariationValid(ped, component, drawable, texture) checks a proposed combination.

Keep outfit options for each model. Male and female freemode models have separate item lists. Both setters take global drawable indices across the model’s loaded collections. Check the mappings again when collections change. For additional clothing assets, see Clothing and props.

Argument Components Props
Slot 0–11, using PedComponent 0–12, using PedProp
Drawable 0–65535 -1–65535
Texture 0–255 0–255
Palette 0–3 Unused

Use integer arguments. Setters return true when the selection is accepted and false for a rejected slot or variation. Wrong argument types throw an error.

Clients also check the loaded model. An unavailable component combination is skipped, leaving that component at its default. An unavailable prop combination leaves the prop cleared. A setter can therefore accept a value that the model cannot display. Use the native queries and check the result on the preview when building an outfit catalogue.

For a clothing shop, validate the selected item against the character’s model-specific catalogue on the server before applying it.

Method Result
getComponentVariation(component) Stored { drawable, texture, palette }, or null when the slot has no stored selection.
getProp(prop) Stored { drawable, texture }, or null when the slot has no stored selection. A cleared prop has drawable: -1.
clearProp(prop) Removes the selected prop and stores that cleared state.
clearProps() Clears every prop slot.
setDefaultComponentVariation() Clears component selections and applies model defaults, keeping stored props and face settings.

The getters return copies of the requested selections. Use the setters to apply changes.

setProp(prop, -1) also clears a prop. Texture must be 0 when drawable is -1.

Resetting components also resets the hairstyle, which uses PedComponent.Hair. When changing only clothes, update the relevant clothing slots to keep the current hairstyle.

Selections survive a model change, so replace them with values for the new model when switching characters. To restore an outfit after reconnecting, save the model and selections in your character data and apply them to the new player object.

Server Ped · Client LocalPed