Object::Object: Difference between revisions

From RAGE Multiplayer Wiki
mNo edit summary
No edit summary
Line 1: Line 1:
'''Function''': Creates a new Object. [http://objects.codeshock.hu/gallery.php Gallery of objects]
'''Function''': Creates a new Object. [https://cdn.rage.mp/public/odb/index.html Gallery of objects]
==Parameters==
==Parameters==
*'''model''': {{RageType|Hash}} (use [[Globals::joaat|mp.joaat]])
*'''model''': {{RageType|Hash}} (use [[Globals::joaat|mp.joaat]])

Revision as of 21:32, 2 April 2018

Function: Creates a new Object. Gallery of objects

Parameters

  • model: Hash (use mp.joaat)
  • position: Vector3
  • rotation: Vector3
  • alpha: Number
  • dimension: Number

Syntax

Shared
mp.objects.new(model, position,
{
    rotation: rotation,
    alpha: alpha,
    dimension: dimension
});

Example

// OUTDATED 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