Jump to content

Bad argument @'bindKey'


saluta

Recommended Posts

Posted
Spoiler
how to turn off the headlights on the server side, because if on the client side, then the person who turned it on only sees and the rest do not see.

function consoleVehicleLights ( thePlayer ) 
    local playerVehicle = getPedOccupiedVehicle ( thePlayer ) 
    if playerVehicle then 
        if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then 
            setVehicleOverrideLights ( playerVehicle, 2 ) 
        else 
            setVehicleOverrideLights ( playerVehicle, 1 ) 
        end 
    end 
end 
addCommandHandler ( "vehiclelights", consoleVehicleLights ) 
addEventHandler ( "onResourceStart", root, consoleVehicleLights)
bindKey("l", "down", "vehiclelights", thePlayer ) 

 

hi, help please.

Spoiler

spacer.png

 

Posted
function consoleVehicleLights (thePlayer) 
    local playerVehicle = getPedOccupiedVehicle ( thePlayer ) 
    if playerVehicle then 
        if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then 
            setVehicleOverrideLights ( playerVehicle, 2 ) 
        else 
            setVehicleOverrideLights ( playerVehicle, 1 ) 
        end 
    end 
end 
addCommandHandler ( "vehiclelights", consoleVehicleLights )  

addEventHandler("onResourceStart", resourceRoot,
    function()
       for _,player in ipairs(getElementsByType("player")) do
       	  bindKey(player, "l", "down", "vehiclelights") 
       end
    end
)

do it this way

  • Thanks 1
Posted
16 hours ago, Burak5312 said:
function consoleVehicleLights (thePlayer) 
    local playerVehicle = getPedOccupiedVehicle ( thePlayer ) 
    if playerVehicle then 
        if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then 
            setVehicleOverrideLights ( playerVehicle, 2 ) 
        else 
            setVehicleOverrideLights ( playerVehicle, 1 ) 
        end 
    end 
end 
addCommandHandler ( "vehiclelights", consoleVehicleLights )  

addEventHandler("onResourceStart", resourceRoot,
    function()
       for _,player in ipairs(getElementsByType("player")) do
       	  bindKey(player, "l", "down", "vehiclelights") 
       end
    end
)

do it this way

Great work bro, do you want to return to the project? i'll do  advertising right now

Posted

 

By the way, if that's all the codes are, keys will not be assigned for newly joined players, so add this line.

addEventHandler("onPlayerJoin", root,
    function()
       bindKey(source, "l", "down", "vehiclelights") 
    end
)

 

  • Like 1

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