qb-ambulancejob

in qb-ambulancejob/client/death.lua CTRL + F and look for:

AddEventHandler('gameEventTriggered', function(event, data)
  • at the beginning of the function add following:

  • if LocalPlayer.state.inDeathmatch == true then return end
  • Your event should look like this:

in qb-ambulancejob/client/main.lua CTRL + F and look for :

local hit, bone = GetPedLastDamageBone(ped)
  • replace whole thread with this:

CreateThread(function()
    while true do
        if not LocalPlayer.state.inDeathmatch or LocalPlayer.state.inDeathmatch == false then
            local ped = PlayerPedId()
            local health = GetEntityHealth(ped)
            local armor = GetPedArmour(ped)

            if not playerHealth then
                playerHealth = health
            end

            if not playerArmor then
                playerArmor = armor
            end

            local armorDamaged = (playerArmor ~= armor and armor < (playerArmor - Config.ArmorDamage) and armor > 0) -- Players armor was damaged
            local healthDamaged = (playerHealth ~= health) -- Players health was damaged

            local damageDone = (playerHealth - health)

            if armorDamaged or healthDamaged then
                local hit, bone = GetPedLastDamageBone(ped)
                local bodypart = Config.Bones[bone]
                local weapon = GetDamagingWeapon(ped)

                if hit and bodypart ~= 'NONE' then
                    local checkDamage = true
                    if damageDone >= Config.HealthDamage then
                        if weapon then
                            if armorDamaged and (bodypart == 'SPINE' or bodypart == 'UPPER_BODY') or weapon == Config.WeaponClasses['NOTHING'] then
                                checkDamage = false -- Don't check damage if the it was a body shot and the weapon class isn't that strong
                                if armorDamaged then
                                    TriggerServerEvent("hospital:server:SetArmor", GetPedArmour(ped))
                                end
                            end

                            if checkDamage then
                                if IsDamagingEvent(damageDone, weapon) then
                                    CheckDamage(ped, bone, weapon, damageDone)
                                end
                            end
                        end
                    elseif Config.AlwaysBleedChanceWeapons[weapon] then
                        if armorDamaged and (bodypart == 'SPINE' or bodypart == 'UPPER_BODY') or weapon == Config.WeaponClasses['NOTHING'] then
                            checkDamage = false -- Don't check damage if the it was a body shot and the weapon class isn't that strong
                        end
                        if math.random(100) < Config.AlwaysBleedChance and checkDamage then
                            ApplyBleed(1)
                        end
                    end
                end

                CheckWeaponDamage(ped)
            end

            playerHealth = health
            playerArmor = armor

            if not isInHospitalBed then
                ProcessDamage(ped)
            end
        end
        Wait(100)
    end
end)

Last updated