C# vehicle Right/LeftIndicatorLightOn return bad result if interiorLight is on

  1. Client (production/canary)
    last production client
  2. What you expected to happen
    IsLeftIndicatorLightOn or IsRightIndicatorLightOn return true if light is ON.
  3. What actually happens
    if vehicle interior light is ON IsLeftIndicatorLightOn or IsRightIndicatorLightOn return bad result
  4. Category of bug (eg. client, server, weapons, peds, native)
    Client script
  5. Reproducible steps, preferably with example script(s)

The problem is GET_VEHICLE_INDICATOR_LIGHTS return:
0: if both indicator are off.
1: if left indicator is on.
2: if right indicator is on.
3 if both indicator are on.

if SET_VEHICLE_INTERIORLIGHT is ON return :
64: if both indicator are off.
65: if left indicator is on.
66: if right indicator is on.
67: if both indicator are on.

Actual c# API is:

IsLeftIndicatorLightOn:
Current: if (val == 1 || val == 3)
is necessary check:
if (val == 1 || val == 3 || val == 65 || val = 67)

IsRightIndicatorLightOn:
Current: if (val >= 2)
is necessary check:
if (val == 2 || val == 3 || val == 66 || val = 67)

Example script for show GET_VEHICLE_INDICATOR_LIGHTS result

        private async Task OnTick()
        {

            if (Game.PlayerPed.IsSittingInVehicle())
            {
                Vehicle veh = Game.PlayerPed.CurrentVehicle;

                veh.IsInteriorLightOn = veh.IsLeftIndicatorLightOn = veh.IsRightIndicatorLightOn = false;

                Debug.WriteLine($"State all off: {API.GetVehicleIndicatorLights(veh.Handle)}"); // 0

                veh.IsLeftIndicatorLightOn = true;
                Debug.WriteLine($"State left on: {API.GetVehicleIndicatorLights(veh.Handle)}"); // 1

                veh.IsLeftIndicatorLightOn = false;
                veh.IsRightIndicatorLightOn = true;
                Debug.WriteLine($"State right on: {API.GetVehicleIndicatorLights(veh.Handle)}"); // 2

                veh.IsLeftIndicatorLightOn = veh.IsRightIndicatorLightOn = true;
                Debug.WriteLine($"State all on: {API.GetVehicleIndicatorLights(veh.Handle)}"); // 3


                veh.IsInteriorLightOn = true;

                veh.IsLeftIndicatorLightOn = veh.IsRightIndicatorLightOn = false;
                Debug.WriteLine($"State interior on: {API.GetVehicleIndicatorLights(veh.Handle)}"); //64

                veh.IsLeftIndicatorLightOn = true;
                Debug.WriteLine($"State interior on, left on: {API.GetVehicleIndicatorLights(veh.Handle)}"); // 65

                veh.IsLeftIndicatorLightOn = false;
                veh.IsRightIndicatorLightOn = true;
                Debug.WriteLine($"State interior on, right on: {API.GetVehicleIndicatorLights(veh.Handle)}"); // 66

                veh.IsLeftIndicatorLightOn = veh.IsRightIndicatorLightOn = true;
                Debug.WriteLine($"State interior on, both on: {API.GetVehicleIndicatorLights(veh.Handle)}"); // 67

            }

           await Delay(1000);
        }
1 Like

Hi,

This issue is caused by one value in memory representing statuses of multiple lights (not just the blinkers). Created & tested a fix and it appears to be working just fine :slight_smile:

Will update the topic once it gets merged in

1 Like