Vehicle::setDirtLevel

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

You can't use values greater than 15.0

(R* does (float)(rand() % 15) to get a random dirt level when generating a vehicle)

Syntax

vehicle.setDirtLevel(dirtLevel);

Required Arguments

  • dirtLevel: float

Return value

  • Undefined

Example

// This is an example for sync dirt level.
mp.events.add('entityStreamIn', (entity) => {
    if (entity.type !== 'vehicle' || !entity.hasVariable('dirtLevel')) {
        return;
    }

    const dirtLevel = entity.getVariable('dirtLevel') || 0;
    entity.setDirtLevel(parseFloat(dirtLevel));
});

See also