Something like this should work

-- Server
TriggerEvent('es:addGroupCommand', 'color', 'admin', function(source, args, user)
	local r = tonumber(args[1])
	local g = tonumber(args[2])
	local b = tonumber(args[3])
	TriggerClientEvent('changecolor', source, r, g, b)
end, function(source, args, user)
	TriggerClientEvent('chat:addMessage', source, { args = {"^1SYSTEM", "Insufficienct permissions!"} })
end, {help = "Change the color of your car", params = {{name = "R", help = "0-255"}}, {{name = "G", help = "0-255"}}, {{name = "B", help = "0-255"}}})

-- Client
RegisterNetEvent('changecolor')
AddEventHandler('changecolor', function(r,g,b)
	local Veh = GetVehiclePedIsIn(PlayerPedId(), false)
	SetVehicleCustomPrimaryColour(Veh, r,g,b)
end)
1 Like