/Repair script

I’m trying to find the script that when your car brakes down you have yo go to the mechanic and run /repair as a command to fix your car. My server is Non ESX AKA reg server

3 Likes

me to

This is the mod your after, Your welcome :slight_smile:

no download link

Here, Click This Link

https://github.com/StockholmCityRP/fivem-realisticvehicle/archive/refs/heads/master.zip

3 Likes

When i put it in my game it wont let me use the command “/repair”

I’ve Looked Through The Script And It Doesn’t Have The Register Command Part. I’ve Been Thinking And Im Gonna Code A Custom Script. When I’ve Finished Making It I’ll Upload It To Github Then Post It On This Topic.

1 Like

same have you found a fix yet ??

@RedRock1 @Snepp @jomamma123

Client.lua

RegisterCommand("fix", function() -- Change "fix" if you wanna change the command
    local ped = PlayerPedId() -- Gets Player
    local veh = GetVehiclePedIsIn(ped) -- Get Vehicle Player Is In

    if IsPedSittingInAnyVehicle(ped) == false then -- Makes Sure Ped In In The Car
            return -- If Not In Vehicle Script Ends
        end
            if IsPedSittingInAnyVehicle(ped) == true then -- Makes Sure Ped In In The Car
            BringVehicleToHalt(veh, 2, 2, true) -- Stops Car
            SetVehicleFixed(veh) -- Fixes Car
            SetVehicleEngineOn(veh, true, true, false) -- Turns Engine On
            TriggerEvent('chatMessage', "Repair", {200,0,0}, "Your Car Is A lot Better!") -- A Little Message
    end
end)

fxmanifest.lua

fx_version 'cerulean'
games {'gta5'}

client_scripts {
    'client.lua',
}

No offence, but the above code is bad. It’s great to see someone posting an answer to help people, but that code is poorly optimised. It’s a duplicate answer and I replied to it on this thread as well;

But try this instead, please. If you guys still need a repair function.

RegisterCommand("fix", function()
	local ped = PlayerPedId()
	local vehicle = GetVehiclePedIsIn(ped, false)
	if vehicle ~= 0 and GetPedInVehicleSeat(vehicle, -1) == ped then
		SetVehicleFixed(vehicle)
		SetVehicleDeformationFixed(vehicle) -- Unsure if needed after SetVehicleFixed
		SetVehicleUndriveable(vehicle, false)
	end
end)

Sorry, Twisle, I am not following you around to be rude, I am browsing the “Latest Topics” section and posting support haha