Advertisement
gftfhg

Untitled

Apr 19th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 10.60 KB | None | 0 0
  1. PASTEBINnew pastePRO    API tools faq deals
  2. search...
  3.  
  4.  
  5. gftfhg
  6. FREE
  7.    1  
  8. My Pastes
  9. Nothing here yet...
  10. Public Pastes
  11. Untitled
  12. 10 sec ago
  13. configtx.yaml
  14. 12 sec ago
  15. Frick EECS 280 BST
  16. 13 sec ago
  17. Untitled
  18. 13 sec ago
  19. 123123
  20. 13 sec ago
  21. Untitled
  22. C | 18 sec ago
  23. For duel booking c...
  24. 21 sec ago
  25. Untitled
  26. 23 sec ago
  27. daily pastebin  goal
  28. 33%
  29. help support pastebin
  30.  
  31. SHARE
  32. TWEET
  33.  
  34. Untitled
  35.  A GUEST   APR 19TH, 2019   10   NEVER
  36.  
  37. Want to supercharge your Pastebin account? Upgrade to a PRO account! Learn the 24 reasons why you should :-)
  38. rawdownloadcloneembedreportprint text 4.30 KB
  39. local Keys = {
  40.   ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  41.   ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  42.   ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  43.   ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  44.   ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  45.   ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  46.   ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  47.   ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  48.   ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  49. }
  50.  
  51. ESX                     = nil
  52. local CurrentAction     = nil
  53. local PlayerData        = {}
  54.  
  55. Citizen.CreateThread(function()
  56.     while ESX == nil do
  57.         TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  58.         Citizen.Wait(0)
  59.     end
  60. end)
  61.  
  62. RegisterNetEvent('esx:playerLoaded')
  63. AddEventHandler('esx:playerLoaded', function(xPlayer)
  64.     PlayerData = xPlayer
  65. end)
  66.  
  67. RegisterNetEvent('esx:setJob')
  68. AddEventHandler('esx:setJob', function(job)
  69.   PlayerData.job = job
  70. end)
  71.  
  72. RegisterNetEvent('esx_repairkit:onUse')
  73. AddEventHandler('esx_repairkit:onUse', function()
  74.     local playerPed     = GetPlayerPed(-1)
  75.     local coords        = GetEntityCoords(playerPed)
  76.     local vehicle = VehicleInFront()
  77.     loadAnimDict("mini@repair")
  78.  
  79.     if IsPedInAnyVehicle(playerPed, false) then
  80.     ESX.ShowNotification("Foot repair")
  81.     else
  82.    
  83.     if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
  84.         local vehicle = nil
  85.  
  86.         if IsPedInAnyVehicle(playerPed, false) then
  87.             vehicle = GetVehiclePedIsIn(playerPed, false)
  88.         else
  89.             vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71)
  90.         end
  91.  
  92.         if DoesEntityExist(vehicle) then
  93.             if Config.IgnoreAbort then
  94.                 TriggerServerEvent('esx_repairkit:removeKit')
  95.             end
  96.             TaskPlayAnim(playerPed, "mini@repair", "fixing_a_ped", 1.0, 2, -1, 49, 0, 0, 0, 0)
  97.             SetVehicleDoorOpen(vehicle, 4, true, true)
  98.             TriggerEvent('repair:freezePlayer', true)
  99.  
  100.             Citizen.CreateThread(function()
  101.             Citizen.Wait(10000)
  102.                 ThreadID = GetIdOfThisThread()
  103.                 CurrentAction = 'repair'
  104.  
  105.                 Citizen.Wait(Config.RepairTime * 1000)
  106.  
  107.                 if CurrentAction ~= nil then
  108.                     SetVehicleFixed(vehicle)
  109.                     SetVehicleDeformationFixed(vehicle)
  110.                     SetVehicleUndriveable(vehicle, false)
  111.                     SetVehicleEngineOn(vehicle, true, true)
  112.                     ClearPedTasksImmediately(playerPed)
  113.                     TriggerEvent('repair:freezePlayer', false)
  114.  
  115.                     ESX.ShowNotification(_U('finished_repair'))
  116.                 end
  117.  
  118.                 if not Config.IgnoreAbort then
  119.                     TriggerServerEvent('esx_repairkit:removeKit')
  120.                 end
  121.  
  122.                 CurrentAction = nil
  123.                 TerminateThisThread()
  124.             end)
  125.         end
  126.  
  127.         Citizen.CreateThread(function()
  128.             Citizen.Wait(0)
  129.  
  130.             if CurrentAction ~= nil then
  131.                 SetTextComponentFormat('STRING')
  132.                 AddTextComponentString(_U('abort_hint'))
  133.                 DisplayHelpTextFromStringLabel(0, 0, 1, -1)
  134.  
  135.                 if IsControlJustReleased(0, Keys["X"]) then
  136.                     TerminateThread(ThreadID)
  137.                     ESX.ShowNotification(_U('aborted_repair'))
  138.                     TriggerEvent('repair:freezePlayer', false)
  139.                     CurrentAction = nil
  140.                 end
  141.             end
  142.  
  143.         end)
  144.     else
  145.         ESX.ShowNotification(_U('no_vehicle_nearby'))
  146.         end
  147.     end
  148. end)
  149.  
  150.  
  151. function loadAnimDict(dict)
  152.     while (not HasAnimDictLoaded(dict)) do
  153.         RequestAnimDict(dict)
  154.         Citizen.Wait(5)
  155.     end
  156. end
  157.  
  158. RegisterNetEvent('repair:freezePlayer')
  159. AddEventHandler('repair:freezePlayer', function(freeze)
  160.     FreezeEntityPosition(GetPlayerPed(-1), freeze)
  161.     FreezeEntityPosition(GetVehiclePedIsUsing(GetPlayerPed(-1)), true)
  162. end)
  163.  
  164. function VehicleInFront()
  165.     local pos = GetEntityCoords(player)
  166.     local entityWorld = GetOffsetFromEntityInWorldCoords(player, 0.0, 6.0, 0.0)
  167.     local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, player, 0)
  168.     local _, _, _, _, result = GetRaycastResult(rayHandle)
  169.     return result
  170. end
  171. RAW Paste Data
  172.  
  173. local Keys = {
  174.   ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  175.   ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  176.   ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  177.   ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  178.   ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  179.   ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  180.   ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  181.   ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  182.   ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  183. }
  184.  
  185. ESX                     = nil
  186. local CurrentAction     = nil
  187. local PlayerData        = {}
  188.  
  189. Citizen.CreateThread(function()
  190.     while ESX == nil do
  191.         TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  192.         Citizen.Wait(0)
  193.     end
  194. end)
  195.  
  196. RegisterNetEvent('esx:playerLoaded')
  197. AddEventHandler('esx:playerLoaded', function(xPlayer)
  198.     PlayerData = xPlayer
  199. end)
  200.  
  201. RegisterNetEvent('esx:setJob')
  202. AddEventHandler('esx:setJob', function(job)
  203.   PlayerData.job = job
  204. end)
  205.  
  206. RegisterNetEvent('esx_repairkit:onUse')
  207. AddEventHandler('esx_repairkit:onUse', function()
  208.     local playerPed     = GetPlayerPed(-1)
  209.     local coords        = GetEntityCoords(playerPed)
  210.     local vehicle = VehicleInFront()
  211.     loadAnimDict("mini@repair")
  212.  
  213.     if IsPedInAnyVehicle(playerPed, false) then
  214.     ESX.ShowNotification("Foot repair")
  215.     else
  216.    
  217.     if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
  218.         local vehicle = nil
  219.  
  220.         if IsPedInAnyVehicle(playerPed, false) then
  221.             vehicle = GetVehiclePedIsIn(playerPed, false)
  222.         else
  223.             vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71)
  224.         end
  225.  
  226.         if DoesEntityExist(vehicle) then
  227.             if Config.IgnoreAbort then
  228.                 TriggerServerEvent('esx_repairkit:removeKit')
  229.             end
  230.             TaskPlayAnim(playerPed, "mini@repair", "fixing_a_ped", 1.0, 2, -1, 49, 0, 0, 0, 0)
  231.             SetVehicleDoorOpen(vehicle, 4, true, true)
  232.             TriggerEvent('repair:freezePlayer', true)
  233.  
  234.             Citizen.CreateThread(function()
  235.             Citizen.Wait(10000)
  236.                 ThreadID = GetIdOfThisThread()
  237.                 CurrentAction = 'repair'
  238.  
  239.                 Citizen.Wait(Config.RepairTime * 1000)
  240.  
  241.                 if CurrentAction ~= nil then
  242.                     SetVehicleFixed(vehicle)
  243.                     SetVehicleDeformationFixed(vehicle)
  244.                     SetVehicleUndriveable(vehicle, false)
  245.                     SetVehicleEngineOn(vehicle, true, true)
  246.                     ClearPedTasksImmediately(playerPed)
  247.                     TriggerEvent('repair:freezePlayer', false)
  248.  
  249.                     ESX.ShowNotification(_U('finished_repair'))
  250.                 end
  251.  
  252.                 if not Config.IgnoreAbort then
  253.                     TriggerServerEvent('esx_repairkit:removeKit')
  254.                 end
  255.  
  256.                 CurrentAction = nil
  257.                 TerminateThisThread()
  258.             end)
  259.         end
  260.  
  261.         Citizen.CreateThread(function()
  262.             Citizen.Wait(0)
  263.  
  264.             if CurrentAction ~= nil then
  265.                 SetTextComponentFormat('STRING')
  266.                 AddTextComponentString(_U('abort_hint'))
  267.                 DisplayHelpTextFromStringLabel(0, 0, 1, -1)
  268.  
  269.                 if IsControlJustReleased(0, Keys["X"]) then
  270.                     TerminateThread(ThreadID)
  271.                     ESX.ShowNotification(_U('aborted_repair'))
  272.                     TriggerEvent('repair:freezePlayer', false)
  273.                     CurrentAction = nil
  274.                 end
  275.             end
  276.  
  277.         end)
  278.     else
  279.         ESX.ShowNotification(_U('no_vehicle_nearby'))
  280.         end
  281.     end
  282. end)
  283.  
  284.  
  285. function loadAnimDict(dict)
  286.     while (not HasAnimDictLoaded(dict)) do
  287.         RequestAnimDict(dict)
  288.         Citizen.Wait(5)
  289.     end
  290. end
  291.  
  292. RegisterNetEvent('repair:freezePlayer')
  293. AddEventHandler('repair:freezePlayer', function(freeze)
  294.     FreezeEntityPosition(GetPlayerPed(-1), freeze)
  295.     FreezeEntityPosition(GetVehiclePedIsUsing(GetPlayerPed(-1)), true)
  296. end)
  297.  
  298. function VehicleInFront()
  299.     local pos = GetEntityCoords(player)
  300.     local entityWorld = GetOffsetFromEntityInWorldCoords(player, 0.0, 6.0, 0.0)
  301.     local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, player, 0)
  302.     local _, _, _, _, result = GetRaycastResult(rayHandle)
  303.     return result
  304. end
  305.  
  306. We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
  307. Upgrade to a Pastebin PRO account!
  308. Learn the 24 reasons why you should :)
  309.              
  310. create new paste  /  dealsnew!  /  syntax languages  /  archive  /  faq  /  tools  /  night mode  /  api  /  scraping api  /  go  
  311. privacy statement  /  cookies policy  /  terms of service  /  security disclosure  /  dmca  /  contact
  312.  
  313. By using Pastebin.com you agree to our cookies policy to enhance your experience.
  314. Site design & logo © 2018 Pastebin; user contributions (pastes) licensed under cc by-sa 3.0 -- Dedicated Server Hosting by Steadfast  
  315. Top
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement