Jump to content

what's wrong?


Matevsz

Recommended Posts

'm writing a script on the lights for the car under the "lshift." When he squeezed it appears gui and light but let 'lshift "is the lights go out. Is is well positioned triggerServerEvent?

Client:

  
function LightsCar() 
    local car = getPedOccupiedVehicle(localPlayer) 
    triggerServerEvent("lights", localPlayer) 
    if car then 
        if getVehicleOverrideLights(car) ~= 2 then 
            guiSetVisible(Lights, true) 
            guiSetVisible(LightsOff, true) 
            guiSetVisible(menu, false) 
        else 
            guiSetVisible(Lights, false) 
            guiSetVisible(LightsOff], false) 
            guiSetVisible(menu, true) 
            guiSetVisible(button, false) 
        end 
    end 
end 
bindKey("lshift", "both", LightsCar) 
  

Server:

  
addEvent("lights", true) 
addEventHandler("lights", root, function() 
    local car = getPedOccupiedVehicle(source) 
    if car then 
        if getVehicleOverrideLights(car) ~= 2 then 
            setVehicleOverrideLights(car, 2) 
        else 
            setVehicleOverrideLights(car, 1) 
        end 
    end 
end) 
  

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