[LUA] Turning lights on car lights

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
349
Reaction score
23
Hello! I am trying to make a mod in LUA where if you press left arrow, the lights (both front and rear) on the left side of the car turn on. Similarily, if you press right arrow, the lights (both front and rear) on the right side of the car turn on. I've tried the only 2 commands that I found on blasthk which is setCarLightsOn & forceCarLightsOn however since it doesn't have proper documentation, I'm not quite sure what I am meant to do and tried a few different things.

For some reason, this code will turn on all the lights, but after what feels like a millisecond, it turns them off.
Code:
    sampRegisterChatCommand("testcommand", function ()
        ped_car = storeCarCharIsInNoSave(playerPed)
        print("pedCAR", ped_car)
        setCarLightsOn(ped_car, true)
        sampAddChatMessage("done", -1)
    end)
Since I didn't know exactly how to use the command forceCarLightsOn and knowing that 2nd param is an int, I tried 3 numbers but they do absolutely nothing.
Code:
    sampRegisterChatCommand("testcommand", function ()
        ped_car = storeCarCharIsInNoSave(playerPed)
        print("pedCAR", ped_car)
        forceCarLights(ped_car, 1)
        sampAddChatMessage("done1", -1)
        forceCarLights(ped_car, 2)
        sampAddChatMessage("done2", -1)
        forceCarLights(ped_car, 3)
        sampAddChatMessage("done3", -1)
    end)
I am really confused how to do this and I could really use some help. Thanks!
 
Top