Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. RegisterNetEvent('esx_mecanojob:onFixkit')
  2. AddEventHandler('esx_mecanojob:onFixkit', function()
  3. local playerPed = GetPlayerPed(-1)
  4. local coords = GetEntityCoords(playerPed)
  5.  
  6. if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
  7.  
  8. local vehicle = nil
  9.  
  10. if IsPedInAnyVehicle(playerPed, false) then
  11. vehicle = GetVehiclePedIsIn(playerPed, false)
  12. else
  13. vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71)
  14. end
  15.  
  16. if DoesEntityExist(vehicle) then
  17. animRunning = true
  18. TaskStartScenarioInPlace(playerPed, "PROP_HUMAN_BUM_BIN", 0, true)
  19. TriggerEvent("mythic_progbar:client:progress", {
  20. name = "repair",
  21. duration = 20000,
  22. label = "Repairing Vehicle",
  23. useWhileDead = false,
  24. canCancel = true,
  25. controlDisables = {
  26. disableMovement = true,
  27. disableCarMovement = true,
  28. disableMouse = false,
  29. disableCombat = true,
  30. },
  31. animation = {
  32. animDict = "missheistdockssetup1clipboard@idle_a",
  33. anim = "idle_a",
  34. },
  35. prop = {
  36. model = "",
  37. }
  38. }, function(status)
  39. if status then
  40. Citizen.CreateThread(function()
  41. SetVehicleFixed(vehicle)
  42. SetVehicleDeformationFixed(vehicle)
  43. SetVehicleUndriveable(vehicle, false)
  44. ClearPedTasksImmediately(playerPed)
  45. TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'success', text = 'Vehicle Repaired' })
  46. ESX.ShowNotification(_U('veh_repaired'))
  47. animRunning = false
  48. end)
  49. end
  50. if not status then
  51. -- Do Something If Event Wasn't Cancelled
  52. end
  53. end)
  54. end
  55. end
  56. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement