Object::Object: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
(alpha updated)
 
(4 intermediate revisions by 4 users not shown)
Line 30: Line 30:
<pre>
<pre>
mp.events.addCommand('flag', (player) => {
mp.events.addCommand('flag', (player) => {
     mp.objects.new('apa_prop_flag_portugal, player.position,
     mp.objects.new('apa_prop_flag_portugal', player.position,
         {
         {
             rotation: player.rotation,
             rotation: player.rotation,
             alpha: 250,
             alpha: 255,
             dimension: player.dimension
             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.
//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 (255 on alpha) and at the same dimension the player is.
</pre>
</pre>
}}
}}

Latest revision as of 12:52, 1 February 2023

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: 255,
            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 (255 on alpha) and at the same dimension the player is.