Train Fuel Mission

fivemGIf

Train Fuel Mission

Preview
Tebex
Discord
Requires Trains

In this mission, designed for at least two players, participants are tasked with looting fuel from a moving train. To complete the mission, players need a fuel pipe, a fuel hose, and a pickup truck equipped with an external fuel tank, which can be purchased. All trains with a tanker container attached can be used for this mission. The looted fuel can either be sold as a full tank at the location where the external tank was acquired or used to fill canisters, which can then be utilized for various purposes such as crafting.

Config.lua
Config = {
    debug = {
        commands = false
    },

    moneySymbol = "€", -- The currency symbol used in the script.

    items = {
        emptyFuelCanister = "fuel_canister_empty", -- Item name for an empty fuel canister.
        fuelCanister = "fuel_canister", -- Item name for a filled fuel canister.
        fuelHose = "smodsk_fuel_hose", -- Item name for a fuel hose.
        fuelPipe = "smodsk_fuel_pipe", -- Item name for a fuel pipe.
    },

    shop = {
        positionPed = vec4(-297.936, -2599.125, 5.196, 45.117), -- Coordinates and heading for the shop ped.
        positionVehicle = vec3(-300.213, -2596.638, 6.000), -- Coordinates for the vehicle at the shop.
        items = {
            { name = 'fuel_canister_empty', price = 10, label = 'Empty Canister' }, -- Price for an empty fuel canister.
            { name = 'smodsk_fuel_hose', price = 10, label = 'Fuel Hose' }, -- Price for a fuel hose.
            { name = 'smodsk_fuel_pipe', price = 10, label = 'Fuel Pipe' }, -- Price for a fuel pipe.
        },

        tankPrice = 100, -- Cost to install a fuel tank in a vehicle.
        fuelPrice = 5, -- Price per liter when selling unused fuel back to the shop.
        tankInstallDuration = 3, -- Time (in seconds) to install a tank.
    },

    mission = {
        minFillSpeed = 8, -- Minimum speed the vehicle must maintain during filling; below this, the hose will detach.
        tankSize = 200, -- Maximum capacity of the vehicle's fuel tank.
        fillTime = 400, -- Time (in seconds) required to fill the tank completely.

        -- Explosion settings: An explosion can occur if the hose becomes too tight or the player leaves the vehicle while the hose is connected.
        explosion = {
            canExplode = true, -- Whether explosions are enabled.
            odds = 5, -- Base explosion probability (percentage).
            odddsIncreasementByFuel = 10, -- Additional explosion probability per fuel percentage filled.
            -- Example: Max explosion chance = 15%.
            explode = function(fuelAmount)
                local percentage = fuelAmount / Config.mission.tankSize -- Calculate how much of the tank is filled.
                local odds = Config.mission.explosion.odds -- Base odds.
                local o = 100 - odds - (Config.mission.explosion.odddsIncreasementByFuel * percentage) -- Adjusted odds.
                local roll = math.random(1, 100) -- Random roll.
                return roll > o -- Explosion occurs if roll exceeds the threshold.
            end,
        },
    },

    trainTanker = {
        startAmount = {50, 100}, -- Initial fuel range in the train tanker.
        maxAmount = 1000, -- Maximum fuel the train tanker can hold.
        generationSpeed = 60, -- Time (in seconds) to generate +1 unit of fuel in the tanker.
    },

    canister = {
        model = "w_am_jerrycan", -- Model hash for the jerrycan.
        canisterSize = 20, -- Minimum tank fuel required to fill one canister.
    },

    rope = { -- Configuration for the fuel hose (rope).
        maxLength = 20, -- Maximum distance (in units) the vehicle can be from the tanker.
        marker = {
            radius = 0.08,
            colors = {
                vec4(0, 255, 0, 200),
                vec4(255, 165, 0, 200),
                vec4(255, 0, 0, 200),
            },
        },
        aiming = {
            radius = 0.1, -- Radius for the aiming markers.
            colors = {
                vec4(0, 255, 0, 200),
                vec4(255, 165, 0, 200),
            },
        },
    },

    keyBinds = {
        ["INSTALL_PIPE"] = 38, -- Key to install the fuel pipe.
        ["INSTALL_HOSE"] = 38, -- Key to install the fuel hose.
        ["REMOVE_PIPE"] = 44, -- Key to remove the fuel pipe.
        ["EXTEND_AIM_DISTANCE"] = 241, -- Key to extend the aiming distance.
        ["REDUCE_AIM_DISTANCE"] = 242, -- Key to reduce the aiming distance.
        ["BUY_FUEL_TANK"] = 38, -- Key to purchase a fuel tank.
        ["SELL_FUEL_TANK"] = 38, -- Key to sell a fuel tank.
    },
}

-- VehicleOffsets defines the attachment points for each vehicle type.
VehicleOffsets = {
    [`rebel`] = vec3(0.00, -1.45, 0.25),
    [`rebel2`] = vec3(0.00, -1.45, 0.25),
    [`sandking2`] = vec3(0.00, -1.87, 0.59),
    [`sandking`] = vec3(0.0, -2.10, 0.3),
    [`riata`] = vec3(0.0, -1.6, 0.3),
    [`bison`] = vec3(0.0, -1.66, 0.23),
}

Code is accessible Partly
Subscription-based Yes & No
Lines (approximately) +1000
Requirements Trains
Support Discord

Most of my scripts are escrowed. However, any code related to frameworks is always NON-ESCROWED. This ensures you can modify these scripts to work with other frameworks if needed.

Other products

3 Likes

nice script bro but i see another script in ur tebex but i cant find review for it
https://smodsk.tebex.io/package/6556080

Do you mean preview?

If that’s what you mean, it would just be a video of trains running on the track. But I can do a small preview of it over the weekend if there’s a need for it.

yes please

if i already have trains and subways running on my server do i need to buy your version of trains to use this heist

1 Like

@sModsk Does you version of ambient trains actually work with OneSync? I’ve tried a few that claimed they have, and they actually don’t After a few players are in and playing, suddenly, its light speed death trains everywhere.

That would be cool, because most train scripts for fivem are buggy and weird. If you managed to make it work, boiiiiiiiii im gonna be happy :smiley:

oh trains ghosting eachother and making player soup of the people in both :smiley:

There is logic linked to my train script, such as carriage identifiers, so unfortunately, it doesn’t work with other scripts.

I don’t use ambient trains. My server-side logic controls the trains and when players are nearby, the players take over the trains. The script works the same way as my metro script TikTok Preview :warning: , meaning players can see in real time on the map where the trains are running.

So if I understand correctly, you scripting simulates where the trains are and when players get near where the trains should be, the trains are rendered for the time the player is around them, correct?

Yes, exactly like this

Here’s a simple preview of the train script, I hope you get something out of the video.