Player::setProp: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
m (Reverted edits by Enotit (talk) to last revision by RoboN1X)
Tag: Rollback
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
This function set prop for player.
This function sets the prop for the player
== Syntax ==
== Syntax ==
<syntaxhighlight lang="javascript">
<pre>
player.setProp(Number propID, Number drawable, Number texture)
player.setProp(propID, drawableID, textureID)
</syntaxhighlight>
</pre>
Props:
Props:
* 0 - Helmets, hats, earphones, masks
* 0 - Helmets, hats, earphones, masks
Line 9: Line 9:
* 2 - Ear accessories
* 2 - Ear accessories
* 6 - Watches
* 6 - Watches
* 7 - bracelets
* 7 - Bracelets
 
=== 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">
{{ServersideCode|
mp.events.add('playerCommand', (player, command) => {
<pre>
  let arr = command.split(' ');
mp.events.addCommand('setprop', (player, args) => {
  if (arr[0] == 'setprop') {
if(!args || isNaN(args[0]) || isNaN(args[1]) || isNaN(args[2])){
    if (arr.length < 4 || !parseInt(arr[1]) || !parseInt(arr[2]) || !parseInt(arr[3])) {
return player.outputChatBox("Syntax: /setprop [propID] [drawableID] [textureID]");
      return player.outputChatBox('Use syntax: /setprop [prop_id] [drawable_id] [texture_id]');
}
    } 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>
}}


==See Also==
==See also==
{{Player_block}}
{{Player_block}}
[[Category:Player Appearance]]
[[Category:Server-side Function]]

Latest revision as of 00:13, 15 June 2020

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