Player::setProp: Difference between revisions

From RAGE Multiplayer Wiki
(Made a simpler command, better layout)
m (Reverted edits by Enotit (talk) to last revision by RoboN1X)
Tag: Rollback
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This function sets the prop for the player
This function sets the prop for the player
== Syntax ==
== Syntax ==
<syntaxhighlight lang="javascript">
<pre>
player.setProp(propID, drawableID, textureID)
player.setProp(propID, drawableID, textureID)
</syntaxhighlight>
</pre>
Props:
Props:
* 0 - Helmets, hats, earphones, masks
* 0 - Helmets, hats, earphones, masks
Line 18: Line 18:
== Example ==
== Example ==
Creates a command called setprops which lets you try out different props
Creates a command called setprops which lets you try out different props
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
{{ServersideCode|
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<pre>
<pre>
mp.events.addCommand('setprop', (player, args) => {
mp.events.addCommand('setprop', (player, args) => {
Line 25: Line 24:
return player.outputChatBox("Syntax: /setprop [propID] [drawableID] [textureID]");
return player.outputChatBox("Syntax: /setprop [propID] [drawableID] [textureID]");
}
}
let cmd = args.split(' ');
let cmd = args.split(' ');
player.setProp(parseInt(cmd[0]), parseInt(cmd[1]), parseInt(cmd[2]));
player.setProp(parseInt(cmd[0]), parseInt(cmd[1]), parseInt(cmd[2]));
});
});
</pre>
</pre>
</div>
}}


==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