Jump to content

Little help needed


isa_Khamdan

Recommended Posts

Posted

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 ) 

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted

How can it be correct? "thePlayer" is not defined.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You must bind it when he player joins, and also when the resource start to every player.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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 ) 

350x20_FFFFFF_FFFFFF_000000_000000.png

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