Player::getProp: Difference between revisions
No edit summary |
No edit summary |
||
| Line 8: | Line 8: | ||
* 1 - Glasses | * 1 - Glasses | ||
* 2 - Ear accessories | * 2 - Ear accessories | ||
== Example == | |||
This example output a prop from prop ID. | |||
<syntaxhighlight lang="javascript"> | |||
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); | |||
} | |||
} | |||
}); | |||
</syntaxhighlight> | |||
Revision as of 18:48, 4 January 2017
This function returns a prop of player.
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);
}
}
});