Object::Object: Difference between revisions
(Created page with "Creates new object. ==Syntax== <syntaxhighlight lang="javascript"> mp.objects.new(model, position, rotation); </syntaxhighlight>") |
No edit summary |
||
| Line 1: | Line 1: | ||
Creates new object. | Creates new object in to the world. | ||
=Syntax= | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
mp.objects.new(model, position, rotation); | mp.objects.new(model, Vector3 position, Vector3 rotation); | ||
</syntaxhighlight> | |||
== '''Required Arguments:''' == | |||
*'''model hash''': <code>mp.joaat('<model_name>')</code> | |||
*'''position''': <b><font color='green'>Vector3</font></b> | |||
*'''rotation''': <b><font color='green'>Vector3</font></b> | |||
=Example= | |||
<syntaxhighlight lang="javascript"> | |||
let pos = player.position; // Returns Vector3 object | |||
pos.y += 1 | |||
pos.z -= 1 | |||
let object = mp.objects.new(mp.joaat('p_stinger_03'), pos , [0, 0, 0]); //Creates a stinger beside the player | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 17:53, 6 December 2017
Creates new object in to the world.
Syntax
mp.objects.new(model, Vector3 position, Vector3 rotation);
Required Arguments:
- model hash:
mp.joaat('<model_name>') - position: Vector3
- rotation: Vector3
Example
let pos = player.position; // Returns Vector3 object
pos.y += 1
pos.z -= 1
let object = mp.objects.new(mp.joaat('p_stinger_03'), pos , [0, 0, 0]); //Creates a stinger beside the player