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
me to
This is the mod your after, Your welcome ![]()
no download link
Here, Click This Link
https://github.com/StockholmCityRP/fivem-realisticvehicle/archive/refs/heads/master.zip
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.
same have you found a fix yet ??
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
anyway to set this up where it will only let you repair if no mechanics are on duty?