Toggle individual vehicle lights

Murdock

  • LU Beta Tester
  • Posts: 237
Toggle individual vehicle lights
«  »
Small snippet to turn each vehicle light on or off

Code: [Select]
enum VehicleLights {
    HeadLeft    = 0x1,
    HeadRight   = 0x4,
    TailLeft    = 0x10,
    TailRight   = 0x40
}

function setLights(vehicle, lightId, isVisible)
{
    if (isVisible) vehicle.LightFlags = vehicle.LightFlags & (~lightId);
    else vehicle.LightFlags = vehicle.LightFlags | lightId;
}

// Usage:
setLights( vehicle, VehicleLights.TailLeft, true );
setLights( vehicle, VehicleLights.TailRight, false );

Sebastian

  • VC:MP Beta Tester
  • Something like this: hga hga hga
  • Posts: 973

=RK=MarineForce

  • Sr. Member
  • WAR IS HELL!
  • Posts: 457
Try to UnderStand ME!

Athanatos

  • Hero Member
  • Romania Cops N Robbers Lead Developer
  • Posts: 848