Jump to content

Help on Fuelsystem


Senze

Recommended Posts

Hey Guys today i started to create a fuel system but so I have one problem the fuel doesn't stop if the player left the car so the fuel only have to stop if the player set the enginestate of the vehicle to false

And have to start drain the fule in the vehicle if the player is start the engine (toggle enginestate to true).

If he forgoten to toggle the enginestate to "false" it will drain more and more

so how can i handler this? create timer for all cars i think this sucks =/

so plz help me =(

Link to comment
Hey Guys today i started to create a fuel system but so I have one problem the fuel doesn't stop if the player left the car so the fuel only have to stop if the player set the enginestate of the vehicle to false

And have to start drain the fule in the vehicle if the player is start the engine (toggle enginestate to true).

If he forgoten to toggle the enginestate to "false" it will drain more and more

so how can i handler this? create timer for all cars i think this sucks =/

so plz help me =(

How else do you want to do it then?

Link to comment

If you have a variable that holds vehicle element then it depends how you want the script to work. You can call your own functions which deal with fuel running out, say:

local vehicle = getPedOccupiedVehicle( player );
setTimer( YOUR_FUEL_FUNC, 10000, 0, vehicle ); -- it'll pass vehicle to YOUR_FUEL_FUNC
 
function YOUR_FUEL_FUNC( veh ) -- timer called this func and passed vehicle element
-- veh will be vehicle element that timer passed in when calling this function
end

It's hard to give snippets because such snippets may not make sense to you. You should start your script and show some code, that way we can suggest what to change or what is wrong in your code.

In case you didn't know, there are fuel scripts already:

http://community.mtasa.com/index.html?p ... ils&id=119

http://community.mtasa.com/index.html?p ... ils&id=190

They are pretty old, so I don't know whether they work or not.

Link to comment

so thank you but i have to try something other and it will work to =)

i create i timer with o local variable and put it into a elementdata (from the current vehicle)

if the player would take of the engine i get the elemtn data and kill the timer so it works =)

Link to comment
  • 2 months later...

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