Difference between revisions of "Player::setClothes"

From RAGE Multiplayer Wiki
Jump to navigation Jump to search
m (category)
m
 
(One intermediate revision by the same user not shown)
(No difference)

Latest revision as of 16:19, 10 August 2019

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

palette = 2

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 0.4.

Syntax

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

List of components:

  • 0 - Head
  • 1 - Beard
  • 2 - Hair
  • 3 - Torso
  • 4 - Legs
  • 5 - Hands
  • 6 - Foot
  • 7 - Eyes
  • 8 - Accessories like parachute, scuba tank
  • 9 - Accessories like bags, mask, scuba mask
  • 10- Decals and mask
  • 11 - Auxiliary parts for torso

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