yacth007 Posted October 27, 2011 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
Castillo Posted October 27, 2011 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)
yacth007 Posted October 27, 2011 Author 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.
Castillo Posted October 27, 2011 Posted October 27, 2011 Dude, I gave you a start, now you'll have to do the rest.
bandi94 Posted October 27, 2011 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
Castillo Posted October 27, 2011 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).
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