Player::setClothes: Difference between revisions

From RAGE Multiplayer Wiki
m (add an information about alternative of client-side function)
No edit summary
Line 4: Line 4:
'''palette''' = 2
'''palette''' = 2


'''Looks like this function can't handle drawable over 255 ! If you need, I suggest you to use player.data & entityDataChange + entityStreamIn events so you can set it client-side with setComponentVariation'''
== 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 ==
== Syntax ==

Revision as of 16:13, 14 October 2018

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.

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