Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function MiningEvent()
- ESX.TriggerServerCallback("esx_MinerJob:getPickaxe", function(pickaxe)
- if pickaxe then
- currentlyMining = true
- local playerPed = PlayerPedId()
- local coords = GetEntityCoords(playerPed)
- FreezeEntityPosition(playerPed, true)
- SetCurrentPedWeapon(playerPed, GetHashKey('WEAPON_UNARMED'))
- Citizen.Wait(200)
- local pickaxe = GetHashKey("prop_tool_pickaxe")
- -- Loads model
- RequestModel(pickaxe)
- while not HasModelLoaded(pickaxe) do
- Wait(1)
- end
- local anim = "melee@hatchet@streamed_core_fps"
- local action = "plyr_front_takedown"
- -- Loads animation
- RequestAnimDict(anim)
- while not HasAnimDictLoaded(anim) do
- Wait(1)
- end
- local object = CreateObject(pickaxe, coords.x, coords.y, coords.z, true, false, false)
- AttachEntityToEntity(object, playerPed, GetPedBoneIndex(playerPed, 57005), 0.1, 0.0, 0.0, -90.0, 25.0, 35.0, true, true, false, true, 1, true)
- exports['progressBars']:startUI((10000), "MINING")
- TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
- Citizen.Wait(2000)
- TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
- Citizen.Wait(2000)
- TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
- Citizen.Wait(2000)
- TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
- Citizen.Wait(2000)
- TaskPlayAnim(PlayerPedId(), anim, action, 3.0, -3.0, -1, 31, 0, false, false, false)
- Citizen.Wait(2000)
- TriggerServerEvent("esx_MinerJob:reward",'stone',5)
- ClearPedTasks(PlayerPedId())
- FreezeEntityPosition(playerPed, false)
- DeleteObject(object)
- currentlyMining = false
- else
- ESX.ShowNotification("You need a ~y~pickaxe~s~ to ~b~mine~s~ here!")
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement