Jump to content

Vehicle engine


josedisla

Recommended Posts

1 hour ago, josedisla said:
Does anyone know of a script that can set a specific vehicle to light by one letter?

hello welcome to forum,I did not understand what you want to do but I wanted to prepare a code...
 

local vehicles = {
    ["vehicle_name"] = true --You can replace the "vehicle_name" with the name of the vehicle you want to use and you can add more vehicles to the list.

}

function onKey( button, pressOrRelease )
    if pressOrRelease == true then
        if button == "x" then
            local vehicle = getPedOccupiedVehicle(localPlayer)
            if vehicles[getVehicleName(vehicle)] then
                -- turn on the headlights
                setVehicleOverrideLights(vehicle, 2)
            end
        end
    elseif pressOrRelease == false then
        if button == "x" then
            local vehicle = getPedOccupiedVehicle(localPlayer)
            if vehicles[getVehicleName(vehicle)] then
                -- turn off the headlights
                setVehicleOverrideLights(vehicle, 0)
            end
        end
    end
end
addEventHandler("onClientKey", root, onKey)

 

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