Advertisement
Guest User

Untitled

a guest
Dec 24th, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. function MiningEvent()
  2. ESX.TriggerServerCallback("esx_MinerJob:getPickaxe", function(pickaxe)
  3. if pickaxe then
  4. currentlyMining = true
  5. local playerPed = PlayerPedId()
  6. local coords = GetEntityCoords(playerPed)
  7.  
  8. FreezeEntityPosition(playerPed, true)
  9. SetCurrentPedWeapon(playerPed, GetHashKey('WEAPON_UNARMED'))
  10. Citizen.Wait(200)
  11.  
  12. local pickaxe = GetHashKey("prop_tool_pickaxe")
  13.  
  14. -- Loads model
  15. RequestModel(pickaxe)
  16. while not HasModelLoaded(pickaxe) do
  17. Wait(1)
  18. end
  19.  
  20. local anim = "melee@hatchet@streamed_core_fps"
  21. local action = "plyr_front_takedown"
  22.  
  23. -- Loads animation
  24. RequestAnimDict(anim)
  25. while not HasAnimDictLoaded(anim) do
  26. Wait(1)
  27. end
  28.  
  29. local object = CreateObject(pickaxe, coords.x, coords.y, coords.z, true, false, false)
  30. AttachEntityToEntity(object, playerPed, GetPedBoneIndex(playerPed, 57005), 0.1, 0.0, 0.0, -90.0, 25.0, 35.0, true, true, false, true, 1, true)
  31.  
  32. exports['progressBars']:startUI((10000), "MINING")
  33. TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
  34. Citizen.Wait(2000)
  35. TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
  36. Citizen.Wait(2000)
  37. TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
  38. Citizen.Wait(2000)
  39. TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
  40. Citizen.Wait(2000)
  41. TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
  42. Citizen.Wait(2000)
  43.  
  44. TriggerServerEvent("esx_MinerJob:reward",'stone',5)
  45.  
  46. ClearPedTasks(PlayerPedId())
  47. FreezeEntityPosition(playerPed, false)
  48. DeleteObject(object)
  49. currentlyMining = false
  50. else
  51. ESX.ShowNotification("You need a ~y~pickaxe~s~ to ~b~mine~s~ here!")
  52. end
  53. end)
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement