Player::getProp: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
This function returns a prop of player. | This function returns a prop of player from ID. | ||
== Syntax == | == Syntax == | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
Revision as of 18:49, 4 January 2017
This function returns a prop of player from ID.
Syntax
let prop = player.getProp(Number propID)
Props:
- 0 - Helmets, hats, earphones, masks
- 1 - Glasses
- 2 - Ear accessories
Example
This example output a prop from prop ID.
mp.events.add('playerCommand', (player, command) => {
let arr = command.split(' ');
if (arr[0] == 'getprop') {
if (arr.length < 2 || !parseInt(arr[1])) {
return player.outputChatBox('Use syntax: /getprop [prop_id]');
} else {
let prop = player.getProp(parseInt(arr[1]));
player.outputChatBox('drawable: ' + prop.drawable + ' texture: ' + prop.texture);
}
}
});