From 455f51e1e58d5f23f67698b2c273ac50c8f2f25d Mon Sep 17 00:00:00 2001 From: WLVF <65689785+WLVF@users.noreply.github.com> Date: Thu, 1 Sep 2022 23:11:33 -0400 Subject: [PATCH] Fuel From Boat Engine + Removed Non-Used Code --- ND_Fuel/source/client.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ND_Fuel/source/client.lua b/ND_Fuel/source/client.lua index 8ceca30..cbff57c 100644 --- a/ND_Fuel/source/client.lua +++ b/ND_Fuel/source/client.lua @@ -416,7 +416,7 @@ CreateThread(function() end end - local veh = vehicleInFront(ped, pedCoords) + local veh = vehicleInFront() -- Animations for manually fueling and effect for sparying fuel. if holdingNozzle and nozzle then @@ -530,17 +530,25 @@ CreateThread(function() Wait(wait) if GetSelectedPedWeapon(ped) == 883325847 and not holdingNozzle and not nozzleInVehicle then wait = 0 - local veh = vehicleInFront(ped, pedCoords) + local veh = vehicleInFront() if veh then local vehClass = GetVehicleClass(veh) local zPos = nozzleBasedOnClass[vehClass + 1] local can = GetAmmoInPedWeapon(ped, 883325847) + local distance = 1.2 if vehClass == 8 and vehClass ~= 13 and not config.electricVehicles[GetHashKey(veh)] then tankBone = GetEntityBoneIndexByName(veh, "petroltank") if tankBone == -1 then tankBone = GetEntityBoneIndexByName(veh, "engine") end + elseif vehClass == 14 and not config.electricVehicles[GetHashKey(veh)] then + tankBone = GetEntityBoneIndexByName(veh, "engine") + if tankBone == -1 then + tankBone = GetEntityBoneIndexByName(veh, "bodyshell") + else + distance = 2.0 + end elseif vehClass ~= 13 and not config.electricVehicles[GetHashKey(veh)] then tankBone = GetEntityBoneIndexByName(veh, "petroltank_l") if tankBone == -1 then @@ -548,7 +556,7 @@ CreateThread(function() end end tankPosition = GetWorldPositionOfEntityBone(veh, tankBone) - if tankPosition and #(pedCoords - tankPosition) < 1.2 then + if tankPosition and #(pedCoords - tankPosition) < distance then local fuel = GetFuel(veh) DrawText3D(tankPosition.x, tankPosition.y, tankPosition.z + zPos, math.floor(fuel) .. "% refuel [E]") local ammo = GetAmmoInPedWeapon(ped, 883325847)