Jump to content

Flashing lights script


TimJ

Recommended Posts

Hey im quite new around these forums and a noob to scripting lua so i hope i post this right lol, anyway i have this script which is supposed to make the headlights on a car (designed for police cars really) flassh like left then right then left if you know what i mean... anyway heres the script, its not finished yet because i got stuck but i hope you get the jist of it:

function Flash ( source ) 
  
    playerVehicle = getPlayerOccupiedVehicle ( source )               
    if ( playerVehicle ) then                                         
        if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then   
            setVehicleOverrideLights ( playerVehicle, 2 )             
            state1 = setVehicleLightState ( playerVehicle, 0,  1 ) 
            state2 = setVehicleLightState ( playerVehicle, 1,  0 ) 
            setVehicleLightState ( playerVehicle, 1,  0 ) 
            setTimer ( flash, 1000, 100, state1 )    
            setTimer ( flash, 500, 100, state2 ) 
    else 
            setVehicleOverrideLights ( playerVehicle, 1, state )             
        end 
    end 
end 
  
  
addCommandHandler ( "flash", Flash ) 

Please help :(

Link to comment
Thanks, that kinda helped but i mean more like blink blink blink, not flash flash flash,

like one side goes out other comes on, that side goes out other side comes back on if you know what i mean...

setVehicleLightState

You can break lights. Break front-left and back-left but fix front-right and back-right then swap. That's how you make it.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...