Player::getClothes: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 25: Line 25:
This example outputs player clothes for component ID.
This example outputs player clothes for component ID.
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.events.add('playerCommand', (player, command) => {
mp.events.addCommand('getclothes', (player, text, component) => {
  let arr = command.split(' ');
   if (component == null || !parseInt(component)) {
   if (arr[0] == 'getclothes') {
    return player.outputChatBox('Use syntax: /getclothes [component_id]');
    if (arr.length < 2 || !parseInt(arr[1])) {
  } else {
      return player.outputChatBox('Use syntax: /getclothes [component_id]');
    let clothes = player.getClothes(parseInt(component));
    } else {
    player.outputChatBox('drawable: ' + clothes.drawable + ' texture: ' + clothes.texture + ' palette: ' + palette.texture);
      let clothes = player.getClothes(parseInt(arr[1]));
      player.outputChatBox('drawable: ' + clothes.drawable + ' texture: ' + clothes.texture + ' palette: ' + palette.texture);
    }
   }
   }
});
});
</syntaxhighlight>
</syntaxhighlight>
==See also==
{{Player_block}}
[[Category:Player Appearance]]
[[Category:Server-side Function]]

Latest revision as of 16:28, 16 April 2020

This function return a hash of player clothes.

Syntax

Object player.getClothes(Number componentNumber)

List of components:

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

Object keys:

  • drawable - ID of clothing.
  • texture - ID of texture.
  • palette - ID of palette.

Example

This example outputs player clothes for component ID.

mp.events.addCommand('getclothes', (player, text, component) => {
  if (component == null || !parseInt(component)) {
    return player.outputChatBox('Use syntax: /getclothes [component_id]');
  } else {
    let clothes = player.getClothes(parseInt(component));
    player.outputChatBox('drawable: ' + clothes.drawable + ' texture: ' + clothes.texture + ' palette: ' + palette.texture);
  }
});

See also