Jump to content

Turn off a automic start engine


yacth007

Recommended Posts

Posted

this problem is a engine vehicle

When i'm enter to vehicle. the vehicle is will auto start engine !

how to turn off it :shock:

I wanna make a manual start engine and stop engine.

sorry for my bad ENG. :oops:

ps. Thank you for see my post :)

Posted
function turnEngine(player) 
    local car = getPedOccupiedVehicle(player) 
    if(car and getVehicleController(car) == player) then 
        setVehicleEngineState(car,(not getVehicleEngineState(car))) 
        if(getVehicleEngineState(car)) then 
            outputChatBox("Engine: Your engine has been turned on.", player, 0, 255, 0) 
        else 
            outputChatBox("Engine: Your engine has been turned off.", player, 255, 0, 0) 
        end 
    end 
end 
addCommandHandler ("engine",turnEngine) 

Posted
function turnEngine(player) 
    local car = getPedOccupiedVehicle(player) 
    if(car and getVehicleController(car) == player) then 
        setVehicleEngineState(car,(not getVehicleEngineState(car))) 
        if(getVehicleEngineState(car)) then 
            outputChatBox("Engine: Your engine has been turned on.", player, 0, 255, 0) 
        else 
            outputChatBox("Engine: Your engine has been turned off.", player, 255, 0, 0) 
        end 
    end 
end 
addCommandHandler ("engine",turnEngine) 

Wow thank you :lol:

but is not yet.

Ex.

one vehicles is stoping engine. and when i enter that vehicle. the vehicle is will starting without my control.

i want when i enter vehicle. the vehicle will stoping or starting engine from last used.

:fadein:

Posted (edited)

if the engine is stil on change the timer to a bigger number

function turnEngine(player) 
     local car = getPedOccupiedVehicle(player) 
   if(car and getVehicleController(car) == player) then 
         setVehicleEngineState(car,(not getVehicleEngineState(car))) 
          if(getVehicleEngineState(car)) then 
            outputChatBox("Engine: Your engine has been turned on.", player, 0, 255, 0) 
       else 
               outputChatBox("Engine: Your engine has been turned off.", player, 255, 0, 0) 
        end 
   end 
  end 
  addCommandHandler ("engine",turnEngine) 
  
function enterVehicle ( theVehicle, seat, jacked ) 
setTimer(setVehicleEngineState,500,1, theVehicle,false) -- here cheange 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enterVehicle )       

Edited by Guest
Posted

bandi, if I'm right, what he's trying to do is to save the vehicle engine state, not to toggle it off (btw, you put false not 'off' to stop the engine).

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