Realistic Fuel Mod 2.2.0.5

Realistic Fuel Mod is an open source software for Grand Theft Auto IV which will add fuels for the vehicles on the Liberty City. Of course vehicles will consume fuel and you can refuel them from fueling stations spread around the city. Source can be found on a public domain license: https://code.google.com/p/realistic-fuel-mod

This script based on the Ultimate Fuel Script v2.1.0.0 source by Pedro Rodrigues and this is just an improved version of it. Contributed for the further development by Sandakelum.

TO INSTALL: Just unzip/extract the contents of the ZIP file you downloaded to GTA IV root directory folder. Keep the folders and paths intact (SlimDX.dll should be placed in the GTA IV root folder where GTAIV.exe exist, and everything else should be at "scripts" folder, as in ZIP file). You need .NET Script Hook v1.7.1.7 BETA, XLiveLess ASI loader (for ScriptHook) and this script developed and tested on GTA IV 1.0.7.0 (recommended).

WARNING: This script also shares Ultimate Fuel Script's GUID (which is "3583e09d-6c44-4820-85e9-93926307d4f8"). So don't use these two script together or it will cause a conflict in some events.

WHAT'S NEW IN 2.2.0.5?

NEW: Fuel Steal Points! Now most garages, vehicle repair shops have fuels in stored for their use. You can use same controls to steal fuel from them. But which will cause you to increase your wanted level by several stars and also, nearby undercover police agents will shoot at you. So, be quick and be smart.
NEW: Added 6+ fuel stealing points around Liberty City.
NEW: Dashboard Positioner, a tool you can use to get very precise coordinates to move your fuel meter gauge. Now bundled with the release. You can find it in Tools folder. Created by Pedro Rodrigues.
NEW: Added an internal method to check for updates from repository.
CHANGE: Changed version scheme to Major.Minor.Revision.Build format.
FIX: Indicator Mod compatibility patch.
FIX: Reserved fuel indicator sound is now plays correctly.
FIX: Fixed bus issue, which caused to crash the script when Niko gets back on, after using a fuel bottle on the bus. Only buses was affected by this issue. Fix by Pedro Rodrigues.
FIX: Wrapped KeyDown function's sub-events with try-catch to avoid most common crashes.
FIX: Used "IS_PLAYER_FREE_FOR_AMBIENT_TASK" native call on multiple locations where player should wait for previous ambient task to be completed, to avoid most animation related crashes. Fix originally provided by Pedro Rodrigues.
FIX: Fixed emergency fuel service's ped animations and delays where he just stares at the vehicle instead fixing it faster. May not be fixed on some cases, such as when running on lower FPS than game's playable FPS.
FIX: Fix for letting player steal fuel bottles from fuel stealing points. Player only can steal liquid fuel as it is only. No fuel bottles.
FIX: Fix to fuel gauge flashing to cause less impact on performence.

Tip: Incase if your game prompted "GTA IV FATAL ERROR: Invalid resource detected - Please re-install the game" error just ignore it and start the game again. It won't occur again, just the first time script get installed.

Sorry, you must be registered and logged in to add a video to this file. Log in now!

I will be grateful if anyone could post few videos which shows the features in this script. Tip: You can incrase the draining speed of a vehicle and record a video using that vehicle, so fuel will be drained so much faster and your video will be short and sweet!

@Timeless_AUT: You may need SlimDX Runtime http://www.slimdx.org, it'll be great if you can paste here what's the error you encountering. Just check ScriptHookDotNet.log and scripts/FuelScript.log files.

Anyway, I updated the ZIP file with SlimDX.dll in it. Just download it again and try. Just unzip/extract the contents of the ZIP file you downloaded to GTA IV root directory folder. Keep the folders and paths intact (SlimDX.dll should be placed in the GTA IV root folder where GTAIV.exe exist, and everything else should be at "scripts" folder, as in ZIP file).

@NikosVidSpot: Yup, just increase the X value. But please note that the screen is measuring from the left side to right. So it won't be aligned to right. That means, you can do what you wanted fine, but if you change your resolution, you may need to change the X value again! Thanks! :)

is there a way to turn off the "Fuel in mission required vehicles will not be drained until the mission is ended. Only free roaming vehicles fuel will be affected to the draining!" thing?:S cause i use Westdyke Safehouse mod and my car in the garage which spawns when the game loads its kind of a mission car. and your mod says its a mission car so the script doesnt drain the fuel

ADD: Now you can toggle whether mission vehicles will drain fuel or not by adjusting settings at [MISC] -> MISSIONVEHICLESDRAIN.

ADD: When you entered to reserved fuel, screen will turn black & white. By refueling or using a fuel bottle turns this state back to normal. Can be turned on or off at the config file [MISC] -> EFFECTS (Beta, this feature may not work properly).

CHANGE: Now you can turn on or off any text notification showing on the screen using the config file [TEXTS] area. Detailed information are there.

FIX: Fixed HELPKEY to BOTTLEUSEKEY, an BOTTLEKEY to BOTTLEBUYKEY making the configurations more clearly.

As this is an open-source mod for GTA IV, please feel free to checkout the source code at https://code.google.com/p/realistic-fuel-mod/ and customize it to your needs, compile it and it can be used for your personal entertainment.

CHANGE: Now Niko is not getting off from Helicopters and Boats to inject fuel bottles. It also means there's no animation for those type of vehicles, just fuel bottle deduction and increment of fuel level.

CHANGE: Changed configuration setting: CLASSICGAUGEWIDTH to W, making the dashboard position parameters easy as X, Y and W (alias for width).

CHANGE: Changed configuration setting: MISSIONVEHICLESDRAIN to MVDRAIN, making it short while the description is in there to user reference.

FIX: Static fuel percentage position if user decreased fuel meter width, now it's dynamic and will automatically adjust to where fuel meter ends.

FIX: Issue with Bus, when using a fuel bottle script crashes. Temporary fixed by not letting Niko get off the bus.

FIX: Script waiting times are now automatically adjust according to player's position and state, and script will properly wait for next events without a crash.

FIX: Fixed few errors that caused to crash the script when entering a new vehicle.

NEW: Emergency Fuel Service! Call to GET-555-FUEL (438-555-3835) or press K (if phone number checks are not working on yours) to call a emergency fuel bouser, which will enter your scene when you ran out of all options (no fuel bottles and couldn't reach to a fueling station in time).

NEW: Now you can set how much fuel bottles player can carry as maximum (MAXFUELBOTTLES).

NEW: Now you can set how much free fuel bottles should be added to the player's inventory when the game loaded (FREEBOTTLES).

NEW: Now you can set how much should player spend to get one fuel bottle (FUELBOTTLECOST).

NEW: Now you can set how much should player cost to get emergency fuel service call (SERVICECOST).

NEW: Now you can set which key should press to call emergency fuel service if phone number checks are not working (calling won't work) by SERVICEKEY.

CHANGE: Optimized FuelScript_Tick() function to be calculated a little more faster.

CHANGE: Added back Play() function to play embedded sound when player enters to the reserved fuel on a vehicle.

FIX: Fixed few percentage and amount calculators to use String.Format() which is a little more faster in overall performance (Solution by Pedro).

FIX: Beta versions doesn't say that it's a beta properly.

FIX: Crash when player gets back to vehicle after refueling his vehicle with a fuel bottle.

FIX: Crash when player luckily gets to a fueling station even when no fuel (using the speed he gained in the vehicle).

FIX: Fixed few comments which were commented with wrongful meaning.

FIX: Fixed script crash when player taking too much time to get back in vehicle after injecting a fuel bottle (known when player runs on lower FPS than game playable FPS, it crashes as player takes too much time to get back on vehicle).

FIX: Fixed unwanted double "if" checks which can be collapsed into one check.

FIX: Dozen more minor bugs has been fixed.

NOTE: Fully commented newly added features and functions on the source code.

@Alex1523 - Expect that soon. If you currently use any mod to save car location over gameplay sessions, please specify what mods you use for that at code.google.com/p/realistic-fuel-mod/issues/detail?id=9, so I can speed up development of that feature. Feel free to post suggestion on that specific features as well.

To simplify moving the fuel indicator around the screen, download this simple application that converts your screen coordinates to the actual values used by the script (percentage of screen size). It should be easy to use, you still have to manually put the values in the ini file tho, maybe I will change that..

anywhere which has a fuel tanker or maybe garages, somewhere in the airport would be cool

it would be great if you could add a feature to save the amount of fuel of cars when you exit then start the game

@pedro2555 I currently use (Skorpro Parked Cars 1.3) but i found the save cars feature in Ultimate Fuel Script v1.2 very awesome as you could save cars and delete cars within the game, there was no messing around with the ini file which was something i liked over (Skorpro Parked Cars 1.3)

Also the fact the amount of fuel was saved with the car was cool and realistic.

if you could somehow bring this feature back but also include the vehicles name when you highlight the blip of the vehicle on the map. also if you were to bring this back could you make it compatible with helicopters and boats as well as cars

it crashed if i attempted to save a helicopter in Ultimate Fuel Script v1.2

if you could somehow bring this feature back but also include the vehicles name when you highlight the blip of the vehicle on the map. also if you were to bring this back could you make it compatible with helicopters and boats as well as cars

it crashed if i attempted to save a helicopter in Ultimate Fuel Script v1.2

@1310crash - That error is already fixed, next time try to send us the log file, I personally won't fix anything if the log file is not sent. Sorry but it takes way too much time to figure out what happen.

@1310crash: We have identified a minor issue and it's been fixed on next release. Since it's not a critical issue and as been used the way it isn't intended to use, I don't think urgent update isn't necessary. 2.2.0.5 will be released when it's due... soon.

@vk9 - Well, this is an open source project, you can not only download the source files for each versions, but you check the development progress in real time. This bug is not yet fixed on the server but it should be in a few hours, keep track here code.google.com/p/realistic-fuel-mod/source/list.

More to the point, if that's what you want, at revision 137 FuelScript.cs line 931 should be removed and moved over to the method FinishRefuel(). And that's it bug fixed.

@vk9 - I guess you are just copying the file FuelScript.cs to your scripts folder, correct? If yes, then just stop doing that, it will never work ok. This mod needs to be compiled to a dll. If you are not a programmer, you should not use the source files as an update source. Neither should you say a fix doesn't work without the knowledge to test it.

For programmers: the compatibility fix for indicator mods done at revision 139 does work correctly.

Excellent mod friend well done! much better then some of the junk out there! btw i lowered the drain by 50% on vehicles just felt it ate too much gas..plus didnt want my car breaking down with a 3-4*wanted vehicle with Arrest Warrant mod installed lmao!! 10/10 keep up the great work 10/10

superb mod! can't wait to test the version that works with indicator script! Ah, and if you could make compatible with emulated gamepads (ps3 controler emulating xbox360 controler) it would be 10/10! thanks!

@luchi - You can try the emulated controller, it may work, it may not. It is a question of testing, since testing everything by myself is not possible, I just can't assure compatability.

@osixo - don't call them junk. But thank you for your comment, I'm very happy to see that the insane amount of ini entries, is usefull after all.

As for the indicator scripts compatibility. We had some polishment actions we wanted to do, and they are taking too long (still I'm not happy as they are). So I will release a patch for 2.2.0.4, just to fix that issue as soon as I get home. The new version will have to wait a bit more.

Yeah I already tested the joypad, actually I always play using a ps3 controler, which emulates a xbox360 controler (DS3tool). Whenever I go to the gas station the correspondent buttons in the controler doesn't work, and then I have to come to the keyboard to do whatever I have to do in the gas station. Is there a workaround for this? If you have some idea of how this could work I would be more than happy to help with anything.

@Lolodid: What kind of a noob are you? Didn't you pressed that Download Now button? Or it isn't going to download itself. Use WinRAR or 7-Zip and open it. And then wear some glasses and look inside it. Don't rate it until you test it.

NEW: Fuel Steal Points! Now most garages, vehicle repair shops have fuels in stored for their use. You can use same controls to steal fuel from them. But which will cause you to increase your wanted level by several stars and also, nearby undercover police agents will shoot at you. So, be quick and be smart.

NEW: Added 6+ fuel stealing points around Liberty City.

NEW: Dashboard Positioner, a tool you can use to get very precise coordinates to move your fuel meter gauge. Now bundled with the release. You can find it in Tools folder. Created by Pedro Rodrigues.

NEW: Added an internal method to check for updates from repository.

CHANGE: Script now showing most messages in AGame.PrintText() and ShowMessage() instead of Game.DisplayText().

CHANGE: Changed version scheme to Major.Minor.Revision.Build format.

FIX: Indicator Mod compatibility patch.

FIX: Reserved fuel indicator sound is now plays correctly.

FIX: Fixed bus issue, which caused to crash the script when Niko gets back on, after using a fuel bottle on the bus. Only buses was affected by this issue. Fix by Pedro Rodrigues.

FIX: Wrapped KeyDown function's sub-events with try-catch to avoid most common crashes.

FIX: Used "IS_PLAYER_FREE_FOR_AMBIENT_TASK" native call on multiple locations where player should wait for previous ambient task to be completed, to avoid most animation related crashes. Fix originally provided by Pedro Rodrigues.

FIX: Fixed emergency fuel service's ped animations and delays where he just stares at the vehicle instead fixing it faster. May not be fixed on some cases, such as when running on lower FPS than game's playable FPS.

FIX: Fix for letting player steal fuel bottles from fuel stealing points. Player only can steal liquid fuel as it is only. No fuel bottles.

@pedro2555 and truekasun Thank you both for creating the fuel script and the indicators script. I know you guys put alot of time into this and despite all the haters, there are some of us who really appreciate the hard work. Been waiting for something like this for a long time. I hope I don't get GTA4 syndrome because now there's a whole new way to play the game.

Sorry about the confusion, the save car function is working on my setup, lol not in the latest release no. It is still not ready for release, the only thing I can add is, the cars keep loaded even when playing missions, so the old disapearing bug is fixed as it looks like. But you still have to wait for it.

Anyone thankfull for the stealing points, you can say thanks to yoshiko, for providing various locations.

The AdvancedHook.dll library is meant to be placed in the same folder as GTAIV.exe, as is SlimDX.dll. (TIP: You just need to drag and drop the contents of the 'files' folder into your GTA IV install directory, no tree changes are needed, just click, yes I want to merge).

The save function available with Ultimate Fuel Script v1.x will not be part of this software. It will instead be released under the name IV Vehicle Saver, and it will, from version 1.0 and up, also store fuel data from this script mod.

Hm... I'm getting a lot of crashing lately. I think it's when I attempt to use any manual function, such as using a bottle for example. Or maybe even refueling at a station.

Also, I wanted to say, that I prefer the previous warning-sound, because the sound there is now makes me think some program in the background crashed or something. I think the previous sound was a longer and higher "beep"? The one used now is too "Windows" if you know what I mean. :P

many scripts i want to use, but only made for 1070. If i cant make the 1070 look as good as 1040 with enbs im not going there. Scripthook 1717 crashes my 1040?? If i can use hook1717 on 1040 ill try it.

Could you make animations of putting the fuel bottle on the gas tank hole? not in the drivers seat! Could you also make animations of buying an bottle model or object of the fuel which you could put back at the trunk of the car and open the trunk and get it when needed which will be more realistic like MR.KOKA's fuel mod (http://www.youtube.com/watch?v=xzpq2w4XmUg)? the concept of your mod is good!

I have found a bug where when the fuel is now 0%, the car doesn't stop sometimes, and I am still driving, but as I manually stop the vehicles, SOMETIMES that time it really stops and break engine and starts the dialogue to inject the fuel bottle, etc. The last version was bug-free last time. please fix this

Everything works, except the fuel meter/gauge won't show. I tried uninstalling all mods, having steam verify game cache, downloaded the newest xliveless and hook I could find. Then I installed this again, everything worked perfectly, except the fuel meter =P Does anyone have any ideas?

Awesome mod, i was using the old version for ages. I just discovered the updates. Excellent work. Wouldn't mind an option to turn off the visual for fuel percentage and number of gas cans though. The flashing can be a bit distracting. Also any word on an update for the IV Vehicle Saver?

Not sure if this is still relevant, but my fuel meter/gauge won't display either, no matter what I do. I tried using only one monitor, disabling all MSI Afterburner overlays, changing resolutions, repositioning the gauge, nothing worked. I'll stay away from this mod for now. It's a shame, because I really love it!