fivem scripting lua write the serverside for an oilslick script that makes your car slide when hitting in a car

here is the client side, Please generate the server side

-- This script allows the user to throw an item to create an oil slick this will make cars that hit it slide
local AnimDict = "core";
local AnimName = "ent_anim_paparazzi_flash"
local WeaponModel = "w_ex_oiltub"
local Animations = {"anim@heists@ornate_bank@thermal_charge", "cover_eyes_intro"}
local OilSlickEquiped = false
local ped = GetPlayerPed(-1)
local slipping = false

--table for oil slicks
local_oil_slicks = {}

--local table of coords to handle
local coords_to_handle = {}

--function for adding slip to vehicle
function AddSlip()
  --create a thread
  Citizen.CreateThread(function()
    --get vehicle ped is in
    local vehicle = GetVehiclePedIsIn(ped, false)
    local old_val = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fTractionCurveLateral")
    --set new traction value
    SetVehicleHandlingFloat(vehicle, "CHandlingData", "fTractionCurveLateral", old_val * 6)
    --wait 7 seconds
    Wait(7000)
    --set traction back to old value
    SetVehicleHandlingFloat(vehicle, "CHandlingData", "fTractionCurveLateral", old_val)
    --set slipping to false
    slipping = false
  end)
end

--event to check local table and remove slick at location
RegisterNetEvent('oil:delete_petrol_decal')
AddEventHandler('oil:delete_petrol_decal', function(coords)
  for k,v in pairs(coords_to_handle) do
    if v == coords then
      RemoveDecal(k)
      --check local oil_slicks table and remove slick at location
      for k,v in pairs(local_oil_slicks) do
        if v == coords then
          local_oil_slicks[k]=nil
        end
      end
    end
  end
end)

Citizen.CreateThread(function()
  while true do
      --if player in vehicle
      if IsPedInAnyVehicle(ped,false)  and not slipping then
        for k,v in pairs(local_oil_slicks) do
          --get distance to slick
          local dist = #(GetEntityCoords(ped) - v)
          if dist < 4 then
            --tell server to tell clients to delete
            TriggerServerEvent('oil:delete_oil_slick', v)
            if slipping == false then
              slipping = true
              AddSlip()
            end
          end
      end
    end
    Wait(200)
  end
end)


--function to create oil slick
function CreateOilSlick(handle)
  -- thread do check for collision with ground
  Citizen.CreateThread(function()
    while true do
      --get coords of entity
      local coords = GetEntityCoords(handle)
      --draw line to it
      -- DrawLine(coords.x, coords.y, coords.z, coords.x, coords.y, coords.z - 10.0, 255, 0, 0, 255)
      local h = GetEntityHeightAboveGround(handle)
      --if collided with ground
      if h <= 0.3 then
        local coords = GetEntityCoords(handle)
        TriggerServerEvent('oil:create_oil_slick', coords)
        break
      end
      Wait(0)
    end
  end)
end

Citizen.CreateThread(function()
  while true do
    ped = GetPlayerPed(-1)
    if OilSlickEquiped == false then
      if GetSelectedPedWeapon(ped) == 277905663 then 
        OilSlickEquiped = true;
      end
    else
      if IsPedShooting(ped) then
        OilSlickEquiped = false;
        local pos = GetEntityCoords(ped)
        Wait(100)
        local handle = GetClosestObjectOfType(pos.x,pos.y,pos.z,50.0,GetHashKey(WeaponModel),false,false,false)
        if handle ~= 0 then 
          CreateOilSlick(handle)
        end
      end
    end
    Wait(0)
  end
end)

--function to create the newly added slick and update local table
RegisterNetEvent('oil:create_petrol_decal')
AddEventHandler('oil:create_petrol_decal', function(coords, oil_slicks)
    --get the ground z coord
    local ret_val, ground_z, normal = GetGroundZFor_3dCoord(coords.x, coords.y, coords.z)
    local new_slick = AddPetrolDecal(coords.x, coords.y, ground_z, 3.0, 6.0, 0.6)
    coords_to_handle[new_slick] = coords
    local_oil_slicks = oil_slicks
end)