So i am using esx and i have a modified version of frfuel that works with it, the thing is it didnt include fuelCost x fuelAmount part of the script so that it could calculate the cost it just had fuelCost, so i added it myself and it works, the only thing that doesnt work it the chat messages nothing comes up even after the money gets taken away
fuelCost = 2
function round(num, numDecimalPlaces)
local mult = 5^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
RegisterServerEvent('frfuel:fuelAdded')-- fuel events
AddEventHandler('frfuel:fuelAdded', function(amount) --fuelAmount
TriggerEvent('es:getPlayerFromId', source, function(xPlayer)
if (xPlayer) then
local cost = (amount) * (fuelCost)
xPlayer.removeMoney(round(cost)), function(response, success)
if(success)then
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "You filled up with " .. round(amount) .. " litres of fuel")
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Filling up today cost you $" .. round(cost))
else
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "You do not have enough money")
end
else
TriggerEvent("es:desyncMsg")
end
end)
end)