[Release] FRFuel [v1.7.0]

@thers I have seen you modify the code, but this can lead to a bug, sometimes the Ontick start before the map is loaded and your blips could be not loaded:

        public async Task OnTick()
         {
         {
+            if (!initialized)
+            {
+                initialized = true;
+
+                LoadConfig();
+
+                CreateBlips();
+                CreateJerryCanPickUps();
+            }

I suggest that

            EventHandlers["onClientMapStart"] += new Action<dynamic>((dynamic res) =>
            {
                CreateBlips();
                CreateJerryCanPickUps();
            });

I just added the "initialized " bool variable inside the CreateBlips(); as a condition if (and I call them differently for the 2 condition since they are separate in this way):

       public void CreateBlips()
        {

            if (_blipsCreated == false)
            {
                _blipsCreated= true;

        public void CreateJerryCanPickUps()
        {
            if (_jerryCreated == false)
            {
                _jerryCreated = true;

This will fix if blips will be duplicated and if Ontick will be loaded before the map is loaded.
If you have inside Ontick sometimes they could not appear.

Script start -> ontick start -> map is not ready -> try to show the new blips -> fail (condition become true anyway)-> map is loaded

Script start -> map is started -> try to show the new blips ( condition become true)

Maybye just loadconfig could remain inside ontick with inizialize:

            if (_inizialize == false)
            {
                _inizialize = true;
                LoadConfig();

            }

This is how it was done before. Unfortunately your suggestion will not work for resource restart, it will simply not init because onClientMapStart isn’t triggered as, well, map is already started.

Unfortunately there’s no 100% reliable way in 5m to intialize resource safely. There’s onClientResourceStart event, but it’s the same as initializing once on the very first tick, because this even fires in the very same time.

So, I’ll stick to current method until i find some more reliable way.

1 Like
This is how it was done before. Unfortunately your suggestion will not work for resource restart, it will simply not init because onClientMapStart isn’t triggered as, well, map is already started.

Unfortunately there’s no 100% reliable way in 5m to intialize resource safely. There’s onClientResourceStart event, but it’s the same as intializing once on the very first tick, because this even fires in the very same time.

So, I’ll stick to current method until i find some more reliable way.

A ok, I had another problem in the other way , when you exit and join again on the server sometimes the fuel doesn’t appear… so there is a problem also in this way XD. Thx for this information I didn’t know this .
Never used the resource restart, do you use any plugin or there is any command for this ? (this can help me scripting)

Maybye if there is a command to realod the map ontick should be fix anything…

removed XD…

I have to point it out that this is very hacky way. And I have to ask you, @DrMagus5, to remove this code from this topic, because it is not related to FRFuel, if you want to share with a community, please, start standalone thread. Please, keep this conversation related to mod itself, thanks.

I’m sorry XD I hoped to help with that problem (restart problem) , I removed it. I will never write anymore because I think I have disturbed in this way . P.S. Just wanted to contribute.

Yeah, just got around to testing the init problem and it worked. Thank you for acting so fast on it :slightly_smiling_face:. love ya on the daily.

Hi, the fuel script stopped working for me and I don’t know why.
I have the latest version of both the server and FRFuel.

Did you try this?

The link fixed it, Thanks a lot!

can you add the message that the doj gas script has

You can easily create a resource yourself that does just that, take a look at this :slight_smile:

how would i added that i dont know much about fivem scripting

Hey, this script works fine for me except for the fact that I cannot seem to get the engine to turn back on via pressing e after refueling. Does anyone know how to fix this issue?

@thers How can I edit the frfuel script so I can add more gas stations to the map because I created custom gas stations in my Server for Police Department RP and I love your script but I cannot edit the frfuel because it is a .dll file. I am not sure how to edit those files. All I want to do is add for gas station fueling areas to the map myself. Could you please help me?

what siren script do you use

It turns out that i somehow downloaded the version of the mod that had that issue. After I updated it was fine :slight_smile:

Really great resource. Can we use other .dll scripts the same way as this?

If they’re made specifically for fivem, yes

2 Likes

@thers Just curious how the progress of expanding the script to work with aircraft and boats is coming along?

1 Like