Player::setProp: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
(Made a simpler command, better layout)
Line 1: Line 1:
This function set prop for player.
This function sets the prop for the player
== Syntax ==
== Syntax ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
player.setProp(Number propID, Number drawable, Number texture)
player.setProp(propID, drawableID, textureID)
</syntaxhighlight>
</syntaxhighlight>
Props:
Props:
Line 9: Line 9:
* 2 - Ear accessories
* 2 - Ear accessories
* 6 - Watches
* 6 - Watches
* 7 - bracelets
* 7 - Bracelets


Check https://wiki.gt-mp.net/index.php?title=Character_Components for a gallery of possible props
=== Parameters ===
*'''propID''': {{RageType|Int}}
*'''drawableID''': {{RageType|Int}}
*'''textureID''': {{RageType|Int}}


== Example ==
== Example ==
This example changes props.
Creates a command called setprops which lets you try out different props
<syntaxhighlight lang="javascript">
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
mp.events.add('playerCommand', (player, command) => {
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
  let arr = command.split(' ');
<pre>
  if (arr[0] == 'setprop') {
mp.events.addCommand('setprop', (player, args) => {
    if (arr.length < 4 || !parseInt(arr[1]) || !parseInt(arr[2]) || !parseInt(arr[3])) {
if(!args || isNaN(args[0]) || isNaN(args[1]) || isNaN(args[2])){
      return player.outputChatBox('Use syntax: /setprop [prop_id] [drawable_id] [texture_id]');
return player.outputChatBox("Syntax: /setprop [propID] [drawableID] [textureID]");
    } else {
}
      player.setProp(parseInt(arr[1]), parseInt(arr[2]), parseInt(arr[3]));
let cmd = args.split(' ');
    }
player.setProp(parseInt(cmd[0]), parseInt(cmd[1]), parseInt(cmd[2]));
  }
});
});
</syntaxhighlight>
</pre>
</div>


==See Also==
==See Also==
{{Player_block}}
{{Player_block}}

Revision as of 01:20, 29 September 2018

This function sets the prop for the player

Syntax

player.setProp(propID, drawableID, textureID)

Props:

  • 0 - Helmets, hats, earphones, masks
  • 1 - Glasses
  • 2 - Ear accessories
  • 6 - Watches
  • 7 - Bracelets

Parameters

  • propID: Int
  • drawableID: Int
  • textureID: Int

Example

Creates a command called setprops which lets you try out different props

Server-Side
mp.events.addCommand('setprop', (player, args) => {
	if(!args || isNaN(args[0]) || isNaN(args[1]) || isNaN(args[2])){
		return player.outputChatBox("Syntax: /setprop [propID] [drawableID] [textureID]");
	}
	let cmd = args.split(' ');
	player.setProp(parseInt(cmd[0]), parseInt(cmd[1]), parseInt(cmd[2]));
});

See Also