- Documentation
- Server functions
- setPedVariant
Function
setPedVariant
Sets a pedestrian's appearance variant: the set of clothes and the skin tone. Every ped model in the Definitive Edition has 4 clothing variants (0-3) and 4 skin variants (0-3); the change is visible to every player. An omitted argument is randomised, which is why createPed gives each NPC a random look. Works for NPCs and for players using a ped skin.
Syntax
bool setPedVariant(ped ped [, int clothes = losowy / random, int skin = losowy / random])Arguments
pedped- An NPC or a player with a ped skin.
clothesint, optional = losowy / random- Clothing variant 0-3 (0 = base).
skinint, optional = losowy / random- Skin variant 0-3 (0 = base).
Returns
true on success, false for values outside 0-3.
Example
local npc = createPed(7, 2490, -1670, 13.3)
setPedVariant(npc, 2, 0)
See also
getPedVariantReturns a pedestrian's current appearance variant: the clothing number and the skin number (both 0-3). Returns 0, 0 when no variant was set.createPedCreates a new NPC ped on the server (a pedestrian driven by the game, not by a player) and shows it right away to every player nearby. The ped gets 100 health, a random appearance variant (clothes and skin tone, seesetPedVariant) and belongs to the resource that created it, so it disappears together with that resource onstop. Optionally it can be made aggressive straight away or told to attack a chosen target.