Jump to content

Little help needed


isa_Khamdan

Recommended Posts

Hello

I am getting little problem with this code it tells me that there are bad arguments with the bind key but I am 100% sure that's it's correct but I don't know why it doesn't work :S

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 ) 
bindKey ( thePlayer , "]", "down", toggleFlashingLights ) 

Link to comment

like this?

  
  
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 bind () 
    bindKey ( source , "]", "down", toggleFlashingLights ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), bind ) 

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...