Jump to content

[V|REL/WIP] Fuel Script


sakis25

Recommended Posts

The code for multiple cars is only to keep track of them, you need to replace all the carGas value with cars[1].fuel to make it use the table instead of the old system.

Or was my lua script not working for you?

 

Your script was not working for me. When I change cars every car has the same amount of fuel.

Link to comment
Share on other sites

There are a few Gas Stations not perfectly alligned like for ex. you aren't in the radius of fueling your car if your standing on the "outside" part of the far most pump from center in case of 3 pumps stations. I've only tried about 3 stations but one of them really needs fixing as it's across the street from the actual station itself. The problematic station it's near LSC 2 (Station 4) and the orig coordinates are {732, -1037, 30} but the correct position (across the road) is at the coordinates {819, -1027, 30}.

Link to comment
Share on other sites

Fuel Script 0.6 is now available!

 

What's New in 0.6:
- Car fuel is now stored for the last 10 vehicles (thanks to faztsquirrel)
- Petrol stations now charge you money (thanks to headscript)
- You can customize the refill with jerry can key (default is L)
- You can adjust the position of the fuel bar
- Blips on the map are a little smaller
- Code optimizations (thanks to faztsquirrel)
- Bug fixes

  • Like 2
Link to comment
Share on other sites

Fuel Script 0.6 is now available!

 

What's New in 0.6:

- Car fuel is now stored for the last 10 vehicles (thanks to faztsquirrel)

- Petrol stations now charge you money (thanks to headscript)

- You can customize the refill with jerry can key (default is L)

- You can adjust the position of the fuel bar

- Blips on the map are a little smaller

- Code optimizations (thanks to faztsquirrel)

- Bug fixes

Would it be possible to say store a jerry can in the boot (i.e., hidden and only given to you when you're at the boot /back of the car and it's open? Since there's some control with that? I haven't used it recently due to file diving but I'd imagine you're having the player carry the can themselves?

 

Knowing me, I'd have probably used the jerry can I had on me to set fire to a prostitute.

Link to comment
Share on other sites

C-h-a-r-l-y

Fuel Script 0.6 is now available!

 

What's New in 0.6:

- Car fuel is now stored for the last 10 vehicles (thanks to faztsquirrel)

- Petrol stations now charge you money (thanks to headscript)

- You can customize the refill with jerry can key (default is L)

- You can adjust the position of the fuel bar

- Blips on the map are a little smaller

- Code optimizations (thanks to faztsquirrel)

- Bug fixes

Great!:)

4bbef5-TITELr.jpg



Link to comment
Share on other sites

dataschmuck

Great Mod! Adds a little more realism to the game!

Here's some ideas I had that would make this into the ultimate fuel mod:

 

Fuel Economy:

Different types of vehicles eat fuel differently.

Trucks, SUVs, Industrial vehicles - Lose fuel quick

Regular Cars - Lose fuel normally

Compacts, Hybrids - lose fuel very very slowly

Electric - no fuel loss at all!

 

Electric & Hybrid:

Have an electric charge meter instead of fuel.

Recharge at supermarket parking lots and in your own garage.

 

No Fuel loss when coasting (not holding down the gas pedal)

 

Fuel drains if tank is punctured

 

Call for refuel:

If you run out of gas out in the middle of nowhere, call for a service truck to come refuel (for a price, of course).

 

Single player Mission vehicles always spawn with a full tank.

 

Script Enable/Disable hotkey in case of emergency.

 

Upgrades at los santos customs:

Tank Size

Increase Fuel Economy

Upgrade to Battery Cells (make it all electric, very expensive)

 

Amount of fuel affects car weight?

Link to comment
Share on other sites

I agree with the above.

 

Also, what about being able to stock up on fuel, maybe a jerry can in the trunk?

Link to comment
Share on other sites

Fuel Script 0.6 is now available!

 

What's New in 0.6:

- Car fuel is now stored for the last 10 vehicles (thanks to faztsquirrel)

- Petrol stations now charge you money (thanks to headscript)

- You can customize the refill with jerry can key (default is L)

- You can adjust the position of the fuel bar

- Blips on the map are a little smaller

- Code optimizations (thanks to faztsquirrel)

- Bug fixes

can you perhaps get rid of the honk for refuel thing and just have a dialog that says something like press e to refuel which only works outside of the car not inside

Link to comment
Share on other sites

I would say every vehicle class should have a specific authonomy and a specific gas tank capacity.

For ex. bikes would have the same authonomy as sedans or compact cars but with a smaller fuel tank.

So a bike could have a 20 liter fuel tank and run the same distance as a 60 liter sedan but for only 33% money for a refuel.

A bike refuel would cost like 20$ while a sedan would be 60$ and a heavy truck for ex. would cost 120$ for 120 liters of gas.

A sports/racing car would have the less authonomy for being very thirsty on fuel and having a medium fuel tank.

 

Every ECU engine upgrade should add an exponential percentage of fuel consumption with turbo topping them all out.

Ex. ECU1 = +2%, ECU2 = +3%, ECU3 = +6%, ECU4 = +10% and turbo = +15% more fuel consumption. Max = ECU4 + Turbo = 125%

 

Leaving a car with the engine running should consume ex. 5% fuel from the idle engine revs.

 

Refueling at a Gas Station should cost (carGas-carFuel)*gasCost where

gasCost = cost of 1L of gas, carFuel = Liters of gas in tank and carGas = car's fuel capacity

Refueling with a "default GTA V" Jerry Can will add 20 Liters of gas to any vehicle's tank.

(a full Jerry Can being 100 ammo units not 22)

 

EDIT: My revised Gas Stations Coordinates:

 

local gasStations = {{-724, -935, 30},{-71, -1762, 30},{265, -1261, 30},{819, -1027, 30},{-2097, -320, 30},
{1212, 2657, 30},{2683, 3264, 30},{-2555, 2334, 30},{180, 6603, 30},{2581, 362, 30},
{1702, 6418, 30},{-1799, 803, 30},{-90, 6415, 30},{264, 2609, 30},{50, 2776, 30},
{2537, 2593, 30},{1182, -330, 30},{-526, -1212, 30},{1209, -1402, 30},{2005, 3775, 30},
{621, 269, 30},{-1434, -274, 30},{1687, 4929, 30}}

Edited by 80T
Link to comment
Share on other sites

this is how i think it could work

 

you drive to the gas pump you get out of your car you pay then you refue

 

my earlier idea was that you get out of your car refuel then walk to the entrance to pay if you don't pay you'll get a star once you leave the gas station but i don't know if you pay after refueling in real life

Link to comment
Share on other sites

Am I the only one getting an error with the new version .6? I get this "Request_Anim_Dict string number expected" error.

Edited by hristi
Link to comment
Share on other sites

ROBDABANKLAITH

there are a couple of hybrid cars in the game, is it possible to make the fuel not drain until a certain speed (when the engine kicks in)
or could you put a battery meter (as said in another post) as well as the fuel meter, and have recharge if you break quickly or accelerate quickly (like KERS in F1)

 

This mod has to be one of the best if not THE best for GTA5. This update is amazing. You truly are amazing, I've tried to learn coding but I find it too difficult so I envy you :D

Link to comment
Share on other sites

Is it normal that after filled the tank the message in the right corner says -1$?

Link to comment
Share on other sites

Is it normal that after filled the tank the message in the right corner says -1$?

Yes, it charges you for the gas, although I think 1$ is too low price for refueling the car :D

Link to comment
Share on other sites

 

Is it normal that after filled the tank the message in the right corner says -1$?

Yes, it charges you for the gas, although I think 1$ is too low price for refueling the car :D

 

 

Actually it charges you constantly -1$ at the time of refueling. Some times it shows your cash above the "-1$" and others not. I'm not sure why this is happening but I will try to find a solution.

Edit: "DISPLAY_CASH(Any p0)" may solve this problem.

 

Please report any other bugs that you may encounter.

Edited by sakis25
Link to comment
Share on other sites

The .6 update is everything I could ask for...thanks again for this mod!

 

 

 

Actually it charges you constantly -1$ at the time of refueling. Some times it shows your cash above the "-1$" and others not. I'm not sure why this is happening but I will try to find a solution.

Edit: "DISPLAY_CASH(Any p0)" may solve this problem.

 

Please report any other bugs that you may encounter.

 

 

I think this is a game limitation. I see this behavior without mods. i.e. When dead peds drop more than one stack of money you'll notice that only the first stack displays the pickup amount. You have to wait some seconds before picking up the next money stack in order to see the amount....otherwise if you pick it up while the first amount is still displayed on the screen, it will never display the amount of the second stack of money. Since the re-fueling is constant, you never see the amount beyond the initial charge of $1. IMO, not a big issue since it removes the proper amount of money anyway.

 

 

Also, some personal tweaks for those interested:

 

-Decreased fuel consumption for less stops to the gas station. Find the line with the following entry:

 

cars[1].fuel = cars[1].fuel - (carspeed/500000)

 

and chage 500000 to 750000

 

-Decreased the jerry can refuel rate to provide less fuel (no more filling up cars from empty). Find the following entry (Note: there are two of them, change both):

 

value.fuel = value.fuel + 0.001

 

and change 0.001 to 0.0001

Edited by CapYoAzz
Link to comment
Share on other sites

few interesting natives:

DISABLE_VEHICLE_IMPACT_EXPLOSION_ACTIVATION
GET_VEHICLE_ACCELERATION
GET_VEHICLE_CLASS
GET_VEHICLE_CLASS_FROM_NAME
GET_VEHICLE_CLASS_MAX_ACCELERATION
GET_VEHICLE_ENGINE_HEALTH
GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS
GET_VEHICLE_MOD_KIT
GET_VEHICLE_MOD_KIT_TYPE
GET_VEHICLE_MODEL_ACCELERATION
GET_VEHICLE_NUMBER_OF_PASSENGERS
GET_VEHICLE_PETROL_TANK_HEALTH
GET_VEHICLE_TRAILER_VEHICLE
IS_BIG_VEHICLE
IS_ENTITY_A_VEHICLE
IS_MODEL_A_VEHICLE
IS_VEHICLE_EXTRA_TURNED_ON
IS_VEHICLE_IN_BURNOUT
IS_VEHICLE_STOPPED

 

maybe they are of any use.

Link to comment
Share on other sites

Bug Report:

 

With this mod installed most of the LS Customs (spray shop) icons are removed from the map. When I remove the mod, the icons are back. Haven't checked yet if any other icons are missing.

 

 

Can someone using the latest version confirm this?

Edited by CapYoAzz
Link to comment
Share on other sites

Can i advice you check again about location of "some/many" gaz station?

Edited by s2nz0
Link to comment
Share on other sites

Can i advice you check again about location of "some/many" gaz station?

 

The only icon that appeared was the one by the airport. Either way there are a total of 4 so if anyone can confirm that they have all 4 of the icons.

Link to comment
Share on other sites

I found a misplaced fuel station. It's a bit off and near LS Customs when it should be here.

 

943de561b5.jpg

 

71d4c969e1.png

Link to comment
Share on other sites

I've already posted the fixed gas stations a few posts above... There are about 3 or 4 small Gas Stations left untouched.

 


 

EDIT: My revised Gas Stations Coordinates:

 

local gasStations = {{-724, -935, 30},{-71, -1762, 30},{265, -1261, 30},{819, -1027, 30},{-2097, -320, 30},
{1212, 2657, 30},{2683, 3264, 30},{-2555, 2334, 30},{180, 6603, 30},{2581, 362, 30},
{1702, 6418, 30},{-1799, 803, 30},{-90, 6415, 30},{264, 2609, 30},{50, 2776, 30},
{2537, 2593, 30},{1182, -330, 30},{-526, -1212, 30},{1209, -1402, 30},{2005, 3775, 30},
{621, 269, 30},{-1434, -274, 30},{1687, 4929, 30}}

Edited by 80T
Link to comment
Share on other sites

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
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.