Object::Object: Difference between revisions

From RAGE Multiplayer Wiki
m (noticed that the current object gallery is down)
m (Reverted edits by Vennox (talk) to last revision by DnAp)
Tag: Rollback
Line 3: Line 3:
Creates a new Object.
Creates a new Object.
   
   
*'''[https://cdn.rage.mp/public/odb/index.html Objects gallery]''' (Currently down)
*'''[https://cdn.rage.mp/public/odb/index.html Objects gallery]'''
*'''[https://gta-objects.xyz/objects Alternative library]'''
 


{{JSContainer|
{{JSContainer|

Revision as of 14:25, 4 April 2021

Shared
Function

 JavaScript


Creates a new Object.


JavaScript Syntax

Syntax

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

Required Arguments

  • model: Hash
  • position: Vector3
  • rotation: Vector3
  • alpha: Number: The object's transparency.
  • dimension: Number

Example

mp.events.addCommand('flag', (player) => {
    mp.objects.new('apa_prop_flag_portugal', player.position,
        {
            rotation: player.rotation,
            alpha: 250,
            dimension: player.dimension
        });
});

//Following this code, you'll create a portuguese flag (apa_prop_flag_portugal) at the players position, facing the same way the player is facing, with no transparency (250 on alpha) and at the same dimension the player is.