No. It won’t, you can’t have resources in FiveM SP.
FRFuel works, but the fuel bar that is typically orange, above where the minimap is, isn’t there, even when the minimap is on.
Do you have the hud turned off in pausemenu > settings > display > hud?
No.
( 20 characters )
Why if I have Pickup = true
We’re not able to pickup the Jerrycan ?
It doesn’t go into our inventory
Not sure, works fine on a fresh server. Probably another resource interfering or a client mod.
Then i have no clue why it’d be hidden.
Is there a way to make this so you have to pay for fuel for esx?
This has been answered about 9 million times already. So, for the 9.000.001st time:
yes, but you will have to script it yourself using the provided events in the original post.
Okay, thanks, but I don’t know how to code lol. Is there any chance you could help me code it?
Many thanks
ZINKS
server side script:
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj)
ESX = obj
end)
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)
local fuel = 1.2
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
TriggerClientEvent('esx:showNotification', _source, "Price of the fuel $" .. fuel)
local cost = fuel * amount
if xPlayer.getMoney() >= cost then
xPlayer.removeMoney((math.ceil(cost*10))/10)
TriggerClientEvent('esx:showNotification', _source, "Refueled " .. round(amount) .. " liters of fuel")
TriggerClientEvent('esx:showNotification', _source, "U paid $" .. round(cost))
else
TriggerClientEvent('gasthiefPlace', source);
TriggerClientEvent('esx:showNotification', _source, "Departed without payment")
end
end)
Just remove Client Event gasthiefPlace if u dont know how to modify esx_jb_outlawalert.
This replaces the server.lua in FrFuel?
U can use this code to make new resource i just give u whole script where u have payment.
Prob u can make new folder with that script + _resource.lua with example:
server_scripts {
'@async/async.lua',
'@mysql-async/lib/MySQL.lua',
'server/main.lua'
}
and it should work
Where would I put that? And how do I link it to the ESX Database??
@ZINKS123 I took the code that @Emru provided and made the file structure for you. It’s 2 files. It is already linked to ESX and will remove the money based on xPlayer.removeMoney((math.ceil(cost*10))/10)
so this should be all you need to do.
I haven’t tested it as I am at work right now, but will be using this for my server as well. Unzip -> Place in [esx] -> Start esx_frfuelcost inside server.cfg
esx_frfuelcost.zip (933 Bytes)
Does anyone have a redesign of the fuel level indicator they’d be willing to share?
Thank you! Means alot!
Let me know if it works m8. I’ll be using it when I get home.
It works! Also, is there a way to see my money go down whilst the fuel is being added? If so, how would I do that and where would the code go lol
The event is only triggered after the fuel has been added. So I don’t think that you can do it at the time of refilling. Though @thers would probably know more about that.
Okay thank you! [20]