Player::setClothes

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

This function set clothing for player. Alternative of client-side function: Player::setComponentVariation

Clothes
Component ID Part Gender
0 Head
1 Masks Male + Female
2 Hair Styles Male Female
3 Torsos Male Female
4 Legs Male Female
5 Bags and Parachutes Male + Female
6 Shoes Male Female
7 Accessories Male Female
8 Undershirts Male Female
9 Body Armors Male Female
10 Decals Male Female
11 Tops Male Female

Known issues

  • This function can't handle drawable over 255. If you need, use player.data & entityDataChange + entityStreamIn events so you can set it client-side with setComponentVariation. Fixed in 1.0+.

Syntax

player.setClothes(Number componentNumber, Number drawable, Number texture, Number palette)

Example

This example changes clothes.

Server-Side
mp.events.add('playerCommand', (player, command) => {
  let arr = command.split(' ');
  if (arr[0] == 'setclothes') {
    if (arr.length < 5 || parseInt(arr[1]) === undefined || parseInt(arr[2]) === undefined || parseInt(arr[3]) === undefined || parseInt(arr[4]) === undefined) {
      return player.outputChatBox('Use syntax: /setclothes [component_id] [drawable_id] [texture_id] [palette_id]');
    } else {
      player.setClothes(parseInt(arr[1]), parseInt(arr[2]), parseInt(arr[3]), parseInt(arr[4]));
    }
  }
});

See also