Object::Object: Difference between revisions
Silverdark (talk | contribs) (Added object gallery and direct object id usage) |
Silverdark (talk | contribs) mNo edit summary |
||
| Line 20: | Line 20: | ||
pos.y += 1 | pos.y += 1 | ||
pos.z -= 1 | pos.z -= 1 | ||
let object = mp.objects.new(mp.joaat('p_stinger_03'), pos , [0, 0, 0]); // Creates a stinger beside the player | let object = mp.objects.new(mp.joaat('p_stinger_03'), pos , [0, 0, 0]); // Creates a stinger beside the player | ||
let object = mp.objects.new(795100068, pos , [0, 0, 0]); // Alternative, mp.joaat(...) resolves the model name into this object id | let object = mp.objects.new(795100068, pos , [0, 0, 0]); // Alternative, mp.joaat(...) resolves the model name into this object id | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 20:59, 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>')or object id - 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
let object = mp.objects.new(795100068, pos , [0, 0, 0]); // Alternative, mp.joaat(...) resolves the model name into this object id