Davey Posted March 5, 2013 Posted March 5, 2013 "Davey" type="script" name="Engine" /> "meta.xml" type="client"/> client="1.3.1" server="1.3.1" /> false is this good its the meta, function turnEngineOff ( theVehicle, leftSeat, jackerPlayer ) if leftSeat == 0 and not jackerPlayer then setVehicleEngineState ( theVehicle, false ) end end -- add 'turnEngineOff' as a handler for "onPlayerExitVehicle" addEventHandler ( "onPlayerVehicleExit", getRootElement ( ), turnEngineOff ) and this is the lua, i think i forgotten the bind or command lua, i love Mta Forever
Davey Posted March 5, 2013 Author Posted March 5, 2013 -- add 'turnEngineOff' as a handler for "onPlayerExitVehicle" oh, and yes i forgotten this last line to delete or i suposed to place back the other lines or is this only a example line? i love Mta Forever
DNL291 Posted March 5, 2013 Posted March 5, 2013 -- add 'turnEngineOff' as a handler for "onPlayerExitVehicle" oh, and yes i forgotten this last line to delete or i suposed to place back the other lines or is this only a example line? Yes, it's just a comment. Please do not PM me with scripting related question nor support, use the forums instead.
Anony# Posted March 5, 2013 Posted March 5, 2013 yes it is only one line example that will not disrupt your script Team, MTA Scripters.
Davey Posted March 5, 2013 Author Posted March 5, 2013 and now the problem i think i need a command lua or something like if i type /engine the engine will stop or start that the target of my script and the script is 2 files meta.xml engine.lua do i miss something? i love Mta Forever
Anony# Posted March 5, 2013 Posted March 5, 2013 (edited) script by jayds1, download: https://community.multitheftauto.com/ind ... ls&id=2254 addEventHandler ( "onPlayerVehicleEnter",root, function( theVehicle, jackerPlayer ) if driver == 0 and not jackerPlayer then setVehicleEngineState ( theVehicle, true ) end end) addEventHandler ( "onPlayerVehicleExit",root, function( theVehicle, jackerPlayer ) if driver == 0 and not jackerPlayer then setVehicleEngineState ( theVehicle, false ) end end) Edited March 5, 2013 by Guest Team, MTA Scripters.
DNL291 Posted March 5, 2013 Posted March 5, 2013 I don't understand what do you mean. Did you mean this?: function toggleEngine(source) local vehicle = getPedOccupiedVehicle(source) if vehicle then local state = getVehicleEngineState(vehicle) setVehicleEngineState(vehicle, not state) end end addCommandHandler( "engine", toggleEngine ) Please do not PM me with scripting related question nor support, use the forums instead.
Moderators IIYAMA Posted March 6, 2013 Moderators Posted March 6, 2013 I don't understand what do you mean. Did you mean this?: function toggleEngine(source) local vehicle = getPedOccupiedVehicle(source) if vehicle then local state = getVehicleEngineState(vehicle) setVehicleEngineState(vehicle, not state) -- wtf?>>>>>>>>>> end end addCommandHandler( "engine", toggleEngine ) Is this possible? setVehicleEngineState(vehicle, not state) ? function toggleEngine(source) local vehicle = getPedOccupiedVehicle(source) if vehicle then if getVehicleEngineState(vehicle) then setVehicleEngineState(vehicle, false) else setVehicleEngineState(vehicle, true) end end end addCommandHandler( "engine", toggleEngine ) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Anderl Posted March 6, 2013 Posted March 6, 2013 It is, 'not state' will return the opposite boolean value. That means, if the engine is on (returns 'true'), 'not state' "returns" the opposite boolean value 'false' and vice versa. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Moderators IIYAMA Posted March 6, 2013 Moderators Posted March 6, 2013 aha thank you Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Anderl Posted March 6, 2013 Posted March 6, 2013 You're welcome "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
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