Difference between revisions of "Vehicle::livery"

From RAGE Multiplayer Wiki
Jump to navigation Jump to search
(Created page with "This property returns vehicle livery. == Example == <source lang="javascript"> // to do </source>")
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
This property returns vehicle livery.
+
This property using for getting or setting vehicle livery.
 +
 
 +
== Setter ==
 +
* {{RageType|int}} livery value
 +
 
 +
== Getter ==
 +
* {{RageType|int}} livery value
  
 
== Example ==
 
== Example ==
 
<source lang="javascript">
 
<source lang="javascript">
// to do
+
mp.events.addCommand({
 +
    //... other commands
 +
    'livery' : (player, _, livery) => {
 +
        if(!player.vehicle) return; // check if player in vehicle or not
 +
        if(!livery || livery < 0 || livery > 2) return; // check player input livery or not, and livery less than 0 or higher than 2
 +
        // livery higher than 2 may work
 +
        player.vehicle.livery = JSON.parse([livery]); // set vehicle's livery
 +
    },
 +
    //... other commands
 +
});
 
</source>
 
</source>

Revision as of 21:23, 12 February 2020

This property using for getting or setting vehicle livery.

Setter

  • int livery value

Getter

  • int livery value

Example

mp.events.addCommand({
    //... other commands
    'livery' : (player, _, livery) => {
        if(!player.vehicle) return; // check if player in vehicle or not
        if(!livery || livery < 0 || livery > 2) return; // check player input livery or not, and livery less than 0 or higher than 2
        // livery higher than 2 may work
        player.vehicle.livery = JSON.parse([livery]); // set vehicle's livery
    },
    //... other commands
});