Fuel Script V - Crash Fix
version 1.1 (community fix)
===========================

A drop-in replacement DLL for Sakis25's Fuel Script V Mod. The original 1.0.3
release (last updated October 2021, abandoned for 4+ years) has a small but
mean logic bug where the refuel prompt locks out exactly when you need it
most. This package replaces only FuelScript.dll. The original FuelScript.ini
is fully compatible — you can keep your existing one or use the included
unchanged copy.


The bug fixed
-------------
RobPol surfaced this on May 22, 2025:

    "i have moeny but i cant refuel becouse i have no money. when i drive
     with low fuel car drive more in reverse than normaly"

The "have money but can't refuel" half traces to FuelScript.Main.onTick
line 306 of the original decompile:

    if (currentCar.Speed < 1f && currentFuel > 5f && !refillCar)

That `currentFuel > 5f` guard means the "Press horn to refuel" prompt only
displays when your tank is ABOVE 5%. If you drove your fuel below 5 (which
is exactly when you most need a gas station), the prompt vanished. With no
way to trigger the refuel state, the script couldn't deduct money or refill
the tank — so the player perception was "I have money but can't refuel".

Fix in v1.1:

    if (currentCar.Speed < 1f && currentFuel < 100f && !refillCar)

Now the prompt displays for any non-full tank. You can roll to a stop at
the pumps with 1% fuel and the refuel option appears as expected.

The "drives faster in reverse" half is a GTA V engine quirk (low-power
states give reverse gear more relative torque) rather than a fuel-mod
bug. We don't touch it.


Bonus stability
---------------
Wrapped onTick in a try/catch. If a single tick ever throws an exception
(stale vehicle reference after a teleport, gas station list edge case),
the fuel bar prints a brief orange recovery ticker instead of letting
SHVDN abort the entire script for the session.


Contents
--------
FuelScript.dll       Patched script. Drop in your /scripts folder
                     (replaces the original FuelScript.dll).
FuelScript.ini       Unchanged from v1.0.3. You can keep your existing
                     ini if you've already customized it.
README.txt           This file.
CHANGELOG.txt        Per version notes.


Requirements
------------
- ScriptHookV
- ScriptHookVDotNet 2 or 3
- NativeUI in your /scripts folder (per Sakis25's original requirements)


Installation
------------
1. Install Sakis25's original Fuel Script V first if you haven't already.
   That sets up NativeUI and any other deps.
   Source: https://www.gta5-mods.com/scripts/fuel-script-v-sakis25
2. Replace FuelScript.dll in your /scripts folder with the one from this
   package.
3. Optional: replace FuelScript.ini, or keep your customized one — the
   schema is unchanged.
4. Launch the game. The fuel bar appears above the minimap as usual.


How to verify the fix is working
--------------------------------
1. Drive your car until fuel is critically low (under 5%).
2. Pull up to any gas station, fully stop the car.
3. You should see "Press horn to refuel your vehicle" with your cash and
   the cost displayed.
4. Hold the horn until the tank fills. Cash is deducted only when the tank
   is full.

In the original v1.0.3 the prompt would NOT appear at step 3 when fuel was
below 5%. With v1.1 it does.


Troubleshooting
---------------
Fuel bar doesn't show.
   Check that NativeUI.dll is in /scripts. Original mod requires it.

Engine cuts at 0 fuel and now you can't roll to a gas station.
   That behaviour is intentional in the original — keep some emergency
   fuel buffer (a jerry can works too: hold W with the jerry can equipped
   near the gas tank of any car to refill from your jerry can ammo).

Refuel says "Not enough cash" even though I have plenty.
   The fuel cost is recalculated when you stop at a gas station. If the
   cost still looks wrong, drive away and come back so the prompt resets.


Credits
-------
Original mod:        Fuel Script V Mod by Sakis25
                     https://www.gta5-mods.com/scripts/fuel-script-v-sakis25
Crash fix:           chris22622

Bug surfaced by:
- RobPol (May 22, 2025): "i have moeny but i cant refuel becouse i have no money"
