vRP | Carfix with group/role permissions

Well to start of with I couldn’t post this in the correct direction due it didn’t allow me to so here we go again, just move this thread!

This is a very simple script but that I’ve got a lot of questions about. This script will allow only groups that you’ve added to use /fix.
By default the groups is “Police Officer”, “Chief of Police”, and “EMS”.
They can simply write /fix to fix their vehicle if it breaks to be able to keep on working etc.

You are allowed to edit this script however you want but always keep the credit to me and don’t claim this script as your own.

There is a installation guide included in vrp_fixcar.rar file! Report any bugs that should be fixed. Thank you!

vrp_fixcar.rar (1.7 KB)

The lua files:
client.lua

RegisterNetEvent("murtaza:fix")
AddEventHandler("murtaza:fix", function()
	local playerPed = GetPlayerPed(-1)
	if IsPedInAnyVehicle(playerPed) then
		local vehicle = GetVehiclePedIsIn(playerPed)
		SetVehicleEngineHealth(vehicle, 9999)
		SetVehiclePetrolTankHealth(vehicle, 9999)
		SetVehicleFixed(vehicle)
	else
	end
end)

function notification(msg)
	SetNotificationTextEntry("STRING")
	AddTextComponentString(msg)
	DrawNotification(false, false)
end

server.lua

local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")

vRP = Proxy.getInterface("vRP")
vRPclient = Tunnel.getInterface("vRP","vRP_fixcar")

AddEventHandler('chatMessage', function(source, name, msg)
	if msg == "/fix" then
	  local user_id = vRP.getUserId({source})
	  local player = vRP.getUserSource({user_id})
	  if vRP.hasGroup({user_id,"Police Officer"}) then
		CancelEvent();
		TriggerClientEvent('murtaza:fix', source);
	  elseif vRP.hasGroup({user_id,"Chief of Police"}) then
		CancelEvent();
		TriggerClientEvent('murtaza:fix', source);	  
	  elseif vRP.hasGroup({user_id,"EMS"}) then
		CancelEvent();
		TriggerClientEvent('murtaza:fix', source);	  
	  end
	end
end)

Have a wonderful day! <3

1 Like

Only recommendation and only saying this because I was going to do the same thing eventually, is add a slight delay using Citizen.Wait(5000), as is lets say there is a police chance and the police car breaks it is an instant fix for them. Adding a 5 second delay gives the criminal a chance still vs. instantly fixed…Just a thought :slight_smile: Good work!

1 Like

I put this mass without resource postage also no server.cfg more will not