Documentation
  • Discord Server
  • About Us
  • Free Resources
    • Death Screen
      • PS-Dispatch Integration
    • Battlepass
      • Guides
      • Commands
        • Player Commands
        • Admin Commands
      • API
        • Server
    • Garages
      • Guides
        • Creating Interior
        • Creating Garage
        • How to find entity sets (customizations) for interior
  • Paid Resources
    • Elevator Creator V2
      • Installation
      • Accessible code
    • Radar System V2
      • Installation
      • Accessible code
    • Hotels Creator
      • Accessible code
    • Vehicle Shop Creator
      • Accessible code
    • Stocks Market
      • Accessible code
      • [DEV] - Usable Functions
    • Discord Voice Attendance
      • Installation
    • Deathmatch System
      • Installation
        • esx_ambulancejob
        • qb-ambulancejob
        • wasabi_ambulance
        • qbx_medical
        • codem-inventory
        • core_inventory
      • Accessible code
    • Object Creator
      • Dependencies
      • Accessible code
    • Cocaine Labs
      • Dependencies
      • Accessible code
    • Ownable Crafting Tables
      • Dependencies
      • Accessible code
      • Common Problems
    • Evidence System
      • Dependencies
      • Accessible code
      • Installation
      • API
    • Marketplace V2
      • Accessible code
      • Installation
      • Migration from V1
    • EMS Dispatch
      • Sending Dispatch
      • Accessing the Menu
      • Config File
    • Weed Planting
      • Accessible code
      • How to add new strain?
      • How to install
    • Advanced DarkNet System
      • Config
    • Advanced Taxi Job
      • Accessible code
      • Changelog
    • Advanced Gang Creator
      • Accessible code
      • Installation
        • QB Core
        • QBOX Core
      • API
      • FAQ
    • Advanced Private Cameras
      • ESX
        • Items
      • QBCore
        • Items
      • Accessible code
    • Advanced Elevator Creator
      • Accessible code
    • Advanced Ownable Rent Creator
      • SQL
      • ESX
      • QBCore
      • Config File
    • Advanced Job Creator
      • Installation
        • QB CORE
      • Accessible code
    • Advanced Ownable Shops
      • Installation
      • Accessible code
      • SQL
    • Advanced Ped Creator
      • SQL
      • Config File
    • Advanced Promocode Creator
      • Accessible code
      • SQL File
      • Common problems
    • Advanced Safe Zone Creator
      • Config File
    • Turf Wars
      • Ox Inventory
      • Accessible code
      • API
    • Advanced Gas Station Creator
      • Accessible code
    • Advanced Advertisements System
      • SQL File
      • Accessible code
    • Player Manager
      • Installation
      • Accessible code
    • Mechanic Job
      • Installation
      • Accessible code
      • SQL
    • Advanced Radar System
      • Accessible code
      • SQL
    • Crypto Mining
      • Installation
      • Accessible code
      • Items
      • SQL
    • Racing System
      • Accessible code
    • Car Theft
      • Accessible code
    • Advanced Solar Panels
      • Accessible Code
      • SQL
      • ESX
        • Items
      • QBCore
        • Items
    • Pilot Job
      • Accessible Code
      • ESX
        • SQL
      • QBCore
        • Metadata
        • qb-smallresources
      • QBOX
        • Metadata
    • Advanced Ownable Banks
      • Accessible Code
    • Post Office
      • Accessible Code
      • ESX
        • SQL
      • QBCore
        • SQL
      • Exports
    • Weather Sync
      • API
    • Billing System
      • Accessible code
      • SQL
      • Common problems
Powered by GitBook
On this page
  • in qb-ambulancejob/client/death.lua CTRL + F and look for:
  • in qb-ambulancejob/client/main.lua CTRL + F and look for :
  1. Paid Resources
  2. Deathmatch System
  3. Installation

qb-ambulancejob

Previousesx_ambulancejobNextwasabi_ambulance

Last updated 11 months ago

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)