[NSWU]Dark

Emergancy Headlights

Recommended Posts

hi im looking for help with this script please it doesnt work

flashTimers = {} 
  
function playFlashSequence ( vehicle ) 
    if ( vehicle ) then                                  
        setVehicleOverrideLights (vehicle, 2) 
        setVehicleLightState (vehicle, 1, 1) 
        setTimer (setVehicleOverrideLights, 200, 1, vehicle, 1) 
        setTimer (setVehicleOverrideLights, 400, 1, vehicle, 2) 
        setTimer (setVehicleOverrideLights, 600, 1, vehicle, 1) 
        setTimer (setVehicleLightState, 600, 1, vehicle, 1, 0) 
        setTimer (setVehicleLightState, 600, 1, vehicle, 0, 1) 
        setTimer (setVehicleOverrideLights, 800, 1, vehicle, 2) 
        setTimer (setVehicleOverrideLights, 1000, 1, vehicle, 1) 
        setTimer (setVehicleOverrideLights, 1200, 1, vehicle, 2) 
        setTimer (setVehicleOverrideLights, 1400, 1, vehicle, 1) 
    end 
end 
  
 function flash ( pSource) 
    flash = not flash 
    playerVehicle = getPlayerOccupiedVehicle ( pSource ) 
    if playerVehicle then 
        if not flashTimers[playerVehicle] then 
            playFlashSequence (playerVehicle) 
            flashTimers[playerVehicle] = setTimer (playFlashSequence, 1400, 0, playerVehicle) 
        elseif flashTimers[playerVehicle] then 
            killTimer (flashTimers[playerVehicle]) 
            setVehicleOverrideLights (playerVehicle, 0) 
            setVehicleLightState (playerVehicle, 0, 0) 
            setVehicleLightState (playerVehicle, 1, 0) 
        end 
    end 
 end 
  
addCommandHandler ( "fl", flash ) 

Share this post


Link to post

Thanks for giving so much info. What exactly happens/doesn't, what errors do you get, etc?

We're not psychic, you know.

Share this post


Link to post

My Bad heyas rob anyway umm i type /fl to activate it and natta not even a error in debug

Share this post


Link to post

hm..strange, cse it works fine for me but with one lag: setTimer function is laggy in dp-versions.. you will have changing world time to 00.00 after you write the command..i have somethin like your script here:

vehicles = {} 
  
function toggleFlashingLights ( thePlayer, key, keyState ) 
        if getPlayerOccupiedVehicleSeat ( thePlayer ) == 0 then 
            if vehicles[getPlayerOccupiedVehicle ( thePlayer )] then 
                killTimer ( vehicles[getPlayerOccupiedVehicle ( thePlayer )] ) 
                vehicles[getPlayerOccupiedVehicle ( thePlayer )] = nil 
            else 
                vehicles[getPlayerOccupiedVehicle ( thePlayer )] = setTimer ( toggleVehicleLights, 250, 0, getPlayerOccupiedVehicle ( thePlayer ) ) 
            end 
        end 
end 
addCommandHandler ( "flash", toggleFlashingLights ) 
  
function toggleVehicleLights ( car ) 
    if ( getVehicleOverrideLights ( car ) ~= 2 ) then 
        setVehicleOverrideLights ( car, 2 ) 
    else 
        setVehicleOverrideLights ( car, 1 ) 
    end 
end 

may be it will help... :)

Share this post


Link to post

ok got most of that sorted out its running however my second headlight isnt working only the left one any suggestions ?

Share this post


Link to post

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.