Player::setClothes: Difference between revisions
(Created page with "This function set a clothing for player. == Syntax == <syntaxhighlight lang="javascript"> Object player.setClothes(Number componentNumber, Number drawable, Number texture, Num...") |
|||
| Line 23: | Line 23: | ||
== Example == | == Example == | ||
This example | This example changes player clothes for component ID. | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
mp.events.add('playerCommand', (player, command) => { | mp.events.add('playerCommand', (player, command) => { | ||
Revision as of 17:34, 4 January 2017
This function set a clothing for player.
Syntax
Object 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 - 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 changes player clothes for component ID.
mp.events.add('playerCommand', (player, command) => {
let arr = command.split(' ');
if (arr[0] == 'getclothes') {
if (arr.length < 4 || !parseInt(arr[1]) || !parseInt(arr[2]) || !parseInt(arr[3])) {
return player.outputChatBox('Use syntax: /getclothes [component_id] [drawable_id] [texture_id] [palette_id]');
} else {
player.setClothes(parseInt(arr[1]), parseInt(arr[2]), parseInt(arr[3]));
}
}
});