gujuk2 0 Posted October 30, 2018 Hi there! I've been trying to make a script for vehicle engine starter. My idea is, that player would have to hold down a key for 2 seconds and then the engine would start. Is there anybody that can help me with this please? Share this post Link to post
Dimos7 88 Posted October 30, 2018 setTimer setVehicleEngineState getVehicleEngineState isPedInVehicle getPedOccupiedVehicle getPedOccupiedVehicleSeat bindKey Share this post Link to post
SaNoR 17 Posted October 31, 2018 function engine() local vehicle = getPedOccupiedVehicle(localPlayer) if isElement(vehicle) and getPedOccupiedVehicleSeat(localPlayer) == 0 then local state = getVehicleEngineState(vehicle) if not state then startTimer = setTimer( function() if isElement(vehicle) and getPedOccupiedVehicleSeat(localPlayer) == 0 then setVehicleEngineState(vehicle, true) end end , 2000, 1) else setVehicleEngineState(vehicle, false) end end end function resetEngine() if isTimer(startTimer) then killTimer(startTimer) end end bindKey("2", "down", engine) bindKey("2", "up", resetEngine) Share this post Link to post
gujuk2 0 Posted October 31, 2018 Thank you very much! I really appreciate it. Share this post Link to post