@thers thank you again for the wonderful script/mod
Confirmed! Thanks for quick reaction!
Is the source code up to date? Because I am trying to edit the script a bit to fit the needs of my server, and i compiled it and it doesn’t work.
Yes, it is always up to date.
Is it possible to add a price so when using essential mode it will be deducted when you’re refueling car
Yes, listen for the events the script triggers and then do your stuff.
I do the following, it works quite well for me…
fuel = 1.19 -- Fuel Cost, this could be made to randomise between 1.05 and 1.30 or something like that
function round(num, numDecimalPlaces)
local mult = 5^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
RegisterServerEvent('frfuel:fuelAdded')
AddEventHandler('frfuel:fuelAdded', function(amount)
for k,v in ipairs(GetPlayers())do
TriggerEvent("es:getPlayerFromId", k, function(user)
if(tonumber(user.money) ~= 0)then
local wallet = user.money
local cost = fuel * amount
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "The price of fuel is $" .. fuel)
local new_wallet = wallet - round(cost)
TriggerEvent("es:setPlayerData", source, "money", new_wallet, function(response, success)
TriggerClientEvent('es:activateMoney', source, new_wallet)
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))
end
end)
else
TriggerClientEvent('chatMessage', -1, "911", {255, 0, 0}, GetPlayerName(source) .." has made off without paying for fuel and is now wanted")
SetPlayerWantedLevel(source, 1, false)
end
end)
end
end)
Am I adding this to the existing script? thank you for sharing
Basically what it does is deduct the price of fuel from the users wallet and if they’ve not got the funds it fills it up and then sets them wanted and sends a global message saying that they’re wanted.
I’ve just got it in a seperate .lua file in my gamemode and referenced it in my resource.lua
omg awesome…wow perfect, am i running this as additional resource?
I run it in my normal gamemode, you can add it to your gamemode.
@thers, what do you say about [this] ([Release] Additional vehicle speedometer [alpha version]) script integration? I can draw fuel indicators and new textures for this. It would be great to make it all-in-one instead of multyresource.
Source code is open and will always be, so feel free to change it as you need.
Oh boy that would be great!
is this a client or server?
also noticed there is a few gas stations missing one in grove st by nearby franklins house kind of then a few more in NW of LS