[Release] [Edit] Rolling Coal

Hello FiveM,
First of all, this is an edit of DieselDave’s script found here
I thought the script was a great idea but it could be improved, so I made my own!

Features:


  • Client sided
  • Faster syncing
  • Smoke based on RPM
  • More realistic smoke
  • Support for multiple exhausts

Bugs:


  • When using vehicles with rear-facing exhausts, depending on the heading of the vehicle, the smoke direction is offset (no idea how to fix this)
  • FPS drops with big smoke pools (burnouts, etc)

Source (client.lua)
local allowedVehicles = {
    "sandking"
}

local intensity = 2

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        for i = -1, 255 do
            Citizen.CreateThread(function()
                local ped = GetPlayerPed(i)
                if ped == -1 then
                    return
                end
                if IsPedInAnyVehicle(ped) then
                    local vehicle = GetVehiclePedIsIn(ped, false)
                    if GetPedInVehicleSeat(vehicle, -1) ~= ped then
                        return
                    end
                    for k,v in pairs(allowedVehicles) do
                        if GetHashKey(v) == GetEntityModel(vehicle) then
                            RequestNamedPtfxAsset("core")
                            while not HasNamedPtfxAssetLoaded("core") do
                                Citizen.Wait(0)
                            end
                            local RPM = GetVehicleCurrentRpm(vehicle)*intensity
                            if ped == GetPlayerPed(-1) then
                                if not IsControlPressed(0, 71) then
                                    RPM = RPM/intensity
                                end
                            end
                            for i=1, 16 do
                                Citizen.CreateThread(function()
                                    local bone = "exhaust_"..i
                                    if i == 1 then
                                        bone = "exhaust"
                                    end
                                    if GetEntityBoneIndexByName(vehicle, bone) == -1 then
                                        return
                                    end
                                    local coords = GetWorldPositionOfEntityBone(vehicle, bone)
                                    local loopAmount = RPM*25
                                    local particleEffects = {}

                                    for x=0,loopAmount do
                                        UseParticleFxAssetNextCall("core")
                                        local particle = StartParticleFxLoopedOnEntityBone("ent_amb_exhaust_thick", vehicle, coords.x, coords.y, coords.z, 0.0, 0.0, 0.0, GetEntityBoneIndexByName(vehicle, bone), RPM, false, false, false)
                                        SetParticleFxLoopedEvolution(particle, "ent_amb_exhaust_thick", RPM, 0)
                                        table.insert(particleEffects, 1, particle)
                                        Citizen.Wait(0)
                                    end
                                    Citizen.Wait(10)
                                    for _,particle in pairs(particleEffects) do
                                        StopParticleFxLooped(particle, true)
                                    end
                                end)
                            end
                        end
                    end
                end
            end)
        end
    end
end)
2 Likes

Download Link? (20 char)

The source is at the bottom of the post

This post needs moving.
Please post in the correct place

Wouldn’t let me post in the releases section, if a mod could move this it would be great!

so does the smoke just keep coming out while driving normally aswell? if so would be cool if it only did it when you held the e break or breaks and gas at the same time.

1 Like

You mentioned client sided, thats no good unless people install it, it should all be server sided

@ThizzIzWhatItIzz The smoke is based on RPM, it works just like you had turned up the injection pump on an engine!

@lordsp1ce The script is stored on a server and streamed to the clients… The original script had client and server files both. Having it client sided means no network events, making the script much faster.

Can you make it to where it’s not blowing smoke all the time?

2 Likes

do i have to have my source.lua look exaclty like that on mines ? cuz im not seeing some of that on mine for reason thats prolly why its not working ingame

there is no source.lua, its the client.lua

How do i install it? and what servers can i use it on if not all?

You dont install it. You go to the client.lua section of the script and copy all the code and go into the diesel dave one and delete it and paste this in.