Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. local Keys = {
  2. ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  3. ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  4. ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  5. ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  6. ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  7. ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  8. ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  9. ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  10. ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  11. }
  12.  
  13. ESX = nil
  14. local CurrentAction = nil
  15. local PlayerData = {}
  16.  
  17. Citizen.CreateThread(function()
  18. while ESX == nil do
  19. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  20. Citizen.Wait(0)
  21. end
  22. end)
  23.  
  24. RegisterNetEvent('esx:playerLoaded')
  25. AddEventHandler('esx:playerLoaded', function(xPlayer)
  26. PlayerData = xPlayer
  27. end)
  28.  
  29. RegisterNetEvent('esx:setJob')
  30. AddEventHandler('esx:setJob', function(job)
  31. PlayerData.job = job
  32. end)
  33.  
  34. RegisterNetEvent('esx_repairkit:onUse')
  35. AddEventHandler('esx_repairkit:onUse', function()
  36. local playerPed = GetPlayerPed(-1)
  37. local coords = GetEntityCoords(playerPed)
  38.  
  39. if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
  40. local vehicle = nil
  41.  
  42. if IsPedInAnyVehicle(playerPed, false) then
  43. vehicle = GetVehiclePedIsIn(playerPed, false)
  44. else
  45. vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71)
  46. end
  47.  
  48. if DoesEntityExist(vehicle) then
  49. if Config.IgnoreAbort then
  50. TriggerServerEvent('esx_repairkit:removeKit')
  51. end
  52. TaskStartScenarioInPlace(playerPed, "PROP_HUMAN_BUM_BIN", 0, true)
  53.  
  54. Citizen.CreateThread(function()
  55. ThreadID = GetIdOfThisThread()
  56. CurrentAction = 'repair'
  57.  
  58. Citizen.Wait(Config.RepairTime * 1000)
  59.  
  60. if CurrentAction ~= nil then
  61. SetVehicleFixed(vehicle)
  62. SetVehicleDeformationFixed(vehicle)
  63. SetVehicleUndriveable(vehicle, false)
  64. SetVehicleEngineOn(vehicle, true, true)
  65. ClearPedTasksImmediately(playerPed)
  66.  
  67. ESX.ShowNotification(_U('finished_repair'))
  68. end
  69.  
  70. if not Config.IgnoreAbort then
  71. TriggerServerEvent('esx_repairkit:removeKit')
  72. end
  73.  
  74. CurrentAction = nil
  75. TerminateThisThread()
  76. end)
  77. end
  78.  
  79. Citizen.CreateThread(function()
  80. Citizen.Wait(0)
  81.  
  82. if CurrentAction ~= nil then
  83. SetTextComponentFormat('STRING')
  84. AddTextComponentString(_U('abort_hint'))
  85. DisplayHelpTextFromStringLabel(0, 0, 1, -1)
  86.  
  87. if IsControlJustReleased(0, Keys["X"]) then
  88. TerminateThread(ThreadID)
  89. ESX.ShowNotification(_U('aborted_repair'))
  90. CurrentAction = nil
  91. end
  92. end
  93.  
  94. end)
  95. else
  96. ESX.ShowNotification(_U('no_vehicle_nearby'))
  97. end
  98. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement