yacth007 Posted October 27, 2011 Share Posted October 27, 2011 this problem is a engine vehicle When i'm enter to vehicle. the vehicle is will auto start engine ! how to turn off it I wanna make a manual start engine and stop engine. sorry for my bad ENG. ps. Thank you for see my post Link to comment
Castillo Posted October 27, 2011 Share Posted October 27, 2011 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) Link to comment
yacth007 Posted October 27, 2011 Author Share Posted October 27, 2011 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 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. Link to comment
Castillo Posted October 27, 2011 Share Posted October 27, 2011 Dude, I gave you a start, now you'll have to do the rest. Link to comment
yacth007 Posted October 27, 2011 Author Share Posted October 27, 2011 Ok Thank you so much Link to comment
bandi94 Posted October 27, 2011 Share Posted October 27, 2011 (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 October 28, 2011 by Guest Link to comment
Castillo Posted October 27, 2011 Share Posted October 27, 2011 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). Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now