Wert Dev Docs
Tebex StoreDiscord
  • ℹ️About Us
  • Products
    • QBCore
      • Wert Pd Roster
      • Wert Jewel Robbery V2
      • Wert Jammer
      • Wert Gps V2
      • Wert Ammunation Jobs
      • Wert Jobs V2
      • Wert Contactless Payment
      • Wert GoPro (Watch vehicles with gopros)
      • Wert Shop Robbery
      • Wert Shops + Delivery Jobs (Buy and manage your shops)
      • Wert Houses
      • Wert Ambulance Job
      • Wert BodyCam (For civilians and jobs)
      • Wert Police Systems V2
      • Wert ChopShop V2
      • Wert Taboo (Play and enjoy)
      • Wert illegal house robbery
      • Wert Banking (Bank ui and system)
      • Wert Paleto Bank Robbery V2
      • Wert Car Arena (Death race, Death match, Arena war)
      • Wert Blackmarket Phone
      • Wert Gang Zone (Advanced Npc System)
      • Wert Fuel Stations (Job, Buy, Manage, Create and more ... )
      • Wert Craft System
      • Wert Merryweather Job
      • Wert Cleaning System And Jobs
      • Wert Weapon Racks (Deployable, Advanced)
      • Wert Water Dispensers (Coolers)
      • Wert Lucky Wheel
      • Wert Evidence System
      • Wert Give Money System
      • Wert Ems Roster System
      • Wert New Year Lottery
      • Wert Vending Machines
    • ESX
      • Wert Shop Robbery
      • Wert Jewel Robbery V2
      • Wert Gps V2
      • Wert Police Systems V2
      • Wert Jobs V2
      • Wert Contactless Payment
      • Wert GoPro (Watch vehicles with gopros)
      • Wert Ammunation Jobs
      • Wert BodyCam (For civilians and jobs)
      • Wert ChopShop V2
      • Wert Taboo (Play and enjoy)
      • Wert illegal house robbery
      • Wert Paleto Bank Robbery V2
      • Wert Jammer
      • Wert Car Arena (Death race, Death match, Arena war)
      • Wert Banking (Bank ui and system)
      • Wert Fuel Stations (Job, Buy, Manage, Create and more ... )
      • Wert Gang Zone (Advanced Npc System)
      • Wert Blackmarket Phone
      • Wert Craft System
      • Wert Merryweather Job
      • Wert Cleaning System And Jobs
      • Wert Weapon Racks (Deployable, Advanced)
      • Wert Water Dispensers (Coolers)
      • Wert Lucky Wheel
      • Wert Evidence System
      • Wert Give Money System
      • Wert Ems Roster System
      • Wert New Year Lottery
      • Wert Pd Roster
      • Wert Vending Machines
      • Wert Ambulance Job
    • Qbox
      • Wert Pd Roster
      • Wert Jewel Robbery V2
      • Wert Jammer
      • Wert Gps V2
      • Wert Ammunation Jobs
      • Wert Jobs V2
      • Wert Contactless Payment
      • Wert GoPro (Watch vehicles with gopros)
      • Wert Shop Robbery
      • Wert Shops + Delivery Jobs (Buy and manage your shops)
      • Wert Houses
      • Wert Ambulance Job
      • Wert BodyCam (For civilians and jobs)
      • Wert Police Systems V2
      • Wert-ChopShopV2
      • Wert Taboo (Play and enjoy)
      • Wert illegal house robbery
      • Wert Banking (Bank ui and system)
      • Wert Paleto Bank Robbery V2
      • Wert Car Arena (Death race, Death match, Arena war)
      • Wert Blackmarket Phone
      • Wert Gang Zone (Advanced Npc System)
      • Wert Fuel Stations (Job, Buy, Manage, Create and more ... )
      • Wert Craft System
      • Wert Merryweather Job
      • Wert Cleaning System And Jobs
      • Wert Weapon Racks (Deployable, Advanced)
      • Wert Water Dispensers (Coolers)
      • Wert Lucky Wheel
      • Wert Evidence System
      • Wert Give Money System
      • Wert Ems Roster System
      • Wert New Year Lottery
      • Wert Vending Machines
    • STANDALONE
      • Wert Npc Dialog System
      • Wert Racing Hud
Powered by GitBook
On this page
  • INSTALLATION
  • QB Inventory Item Format
  • OX Inventory Item Format
  • Important Revive Event
  • OPEN FILES
  • Installation complete
  1. Products
  2. Qbox

Wert Ambulance Job

You can access the setup information you need about this product

INSTALLATION

1 - Don’t forget to import the SQL files inside the Addsql folder into your database.

2 - Make sure that all the required additional scripts are properly installed.

  • interact-sound (https://github.com/plunkettscott/interact-sound)

  • xsound (https://github.com/Xogy/xsound)

3 - Don’t forget to add the sound files from the Addsounds folder into the interact-sound script.

4 - Add the items to your inventory system by following the item instructions below.

The settings for ox_lib and ox_inventory are available in the configuration file. If you’d like, you can manage all settings from there.

QB Inventory Item Format

bloodbag = { name = "bloodbag", label = "Blood Bag", weight = 150, type = "item", image = "bloodbag.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "" },
bloodtube = { name = "bloodtube", label = "Blood Tube", weight = 500, type = "item", image = "bloodtupe.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "" },
emptybaggy = { name = "emptybaggy", label = "Empty Blood Bag", weight = 100, type = "item", image = "emptybaggy.png", unique = false, useable = true, shouldClose = true, combinable = nil, description = "" },
emptysyringe = { name = "emptysyringe", label = "Empty Syringe", weight = 50, type = "item", image = "emptysyringe.png", unique = false, useable = true, shouldClose = true, combinable = nil, description = "" },
emptytube = { name = "emptytube", label = "Empty Tube", weight = 50, type = "item", image = "emptytube.png", unique = false, useable = true, shouldClose = true, combinable = nil, description = "" },
kankart = { name = "kankart", label = "Person Blood Card", weight = 50, type = "item", image = "kankart.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "" },
mri = { name = "mri", label = "MRI Document", weight = 150, type = "item", image = "mri.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "" },
xray = { name = "xray", label = "Xray Document", weight = 150, type = "item", image = "xray.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "" },

OX Inventory Item Format

['bloodbag'] = { label = 'Blood Bag', weight = 150 },
['bloodtube'] = { label = 'Blood Tube', weight = 500 },
['emptybaggy'] = { label = 'Empty Blood Bag', weight = 100 },
['emptysyringe'] = { label = 'Empty Syringe', weight = 50 },
['emptytube'] = { label = 'Empty Tube', weight = 50 },
['kankart'] = { label = 'Person Blood Card', weight = 50 },
['mri'] = { label = 'MRI Document', weight = 150 },
['xray'] = { label = 'Xray Document', weight = 150 },
  • If you're using ox_inventory, after adding the above item codes to the ox_inventory/data/items.lua file, you’ll also need to follow the additional instructions below.

  • Add the following code to the ox_inventory/modules/items/client.lua file. You’ll notice that similar code already exists within the file.

Item('kankart', function(data, slot)
    local metadata = slot.metadata
	if metadata and metadata.kankartdata then
        TriggerEvent("wert-ambulancejob:use-blood-card", metadata.kankartdata)
    else
        print("Blood Card Not Have Data Please Buy A New Card!")
    end
end)

Item('emptysyringe', function(data, slot)
    TriggerEvent('wert-ambulancejob:take-blood')
end)

Item('xray', function(data, slot)
    local metadata = slot.metadata
	if metadata and metadata.plan and metadata.hasta then
        TriggerServerEvent("wert-ambulancejob:server:ox-inventory-use-xray", metadata.plan, metadata.hasta)
    else
        print("Xray Display Not Have Data Please Make A New!")
    end
end)

Item('mri', function(data, slot)
    local metadata = slot.metadata
	if metadata and metadata.plan and metadata.hasta then
        TriggerServerEvent("wert-ambulancejob:server:ox-inventory-use-mri", metadata.plan, metadata.hasta)
    else
        print("MRI Display Not Have Data Please Make A New!")
    end
end)

Important Revive Event

Config.ReviveClientEvent = 'hospital:client:Revive' --# change your revive event this is default qb-core event

OPEN FILES

  • The files listed below are not encrypted. If you have the NO-ESCROW version, all files will be provided as fully open source.

Config = {}
Config.Locale = "en"
Config.DebugPoly = false -- Show target polys (true or false)
Config.OxInventory = true
Config.QBInventoryNew = false
Config.UseTarget = true
Config.TargetSystem = 'ox_target' -- 'qb-target' , 'ox_target'
Config.ReviveClientEvent = 'hospital:client:Revive'
Config.UseBillSystem = true
Config.OxLib = true

Config.EnableCoffeSystem = true
Config.CoffeItem = "coffee"
Config.CoffeMachineModels = { -- # For the Interactions
    `prop_coffee_mac_02`,
}

Config.EnableWaterCoolerSystem = true
Config.WaterCoolerModels = {
    `prop_watercooler`,
}

-- # Interactions

Config.TargetInfos = {
    {
        action = 'duty', -- This is duty target
        coord = vector3(307.55, -595.32, 43.28),
        heading = 340,
        lenght = 1.0,
        width = 1.0,
        minz = 42.2,
        maxz = 43.8,
        icon = 'fa-solid fa-circle-user',
        label = 'Enter - Exit | Duty',
        distance = 1.5,
    },
    {
        action = 'armoryandstash', -- This is armory and stash target
        coord = vector3(306.57, -602.33, 43.28),
        heading = 340,
        lenght = 0.6,
        width = 2.2,
        minz = 42.2,
        maxz = 44.4,
        distance = 1.5,
        armoryLabel = 'Armory',
        armoryIcon = 'fa-solid fa-shop',
        stashLabel = 'Stash',
        stashIcon = 'fa-solid fa-box',
    },
    {
        action = 'bossmenu', -- This is boss menu target
        coord = vector3(335.54, -594.42, 43.28),
        heading = 340,
        lenght = 1.8,
        width = 1.0,
        minz = 42.2,
        maxz = 43.8,
        icon = 'fa-solid fa-clipboard',
        label = 'Boss Menu',
        distance = 1.5,
    },
    {
        action = 'mrcomputer', -- This is mr computer target
        coord = vector3(341.33, -576.66, 43.28),
        heading = 340,
        lenght = 1.4,
        width = 1.0,
        minz = 42.8,
        maxz = 44.0,
        icon = 'fa-solid fa-desktop',
        label = 'MRI Computer',
        distance = 1.5,
    },
    {
        action = 'xraycomputer', -- This is xray computer target
        coord = vector3(344.54, -577.97, 43.28),
        heading = 340,
        lenght = 1.4,
        width = 1.0,
        minz = 42.8,
        maxz = 44.0,
        icon = 'fa-solid fa-desktop',
        label = 'XRAY Computer',
        distance = 1.5,
    },
    {
        action = 'mrdesk', -- This is mr desk target
        coord = vector3(336.98, -575.21, 43.28),
        heading = 340,
        lenght = 2.6,
        width = 1.0,
        minz = 42.4,
        maxz = 44.0,
        distance = 1.5,
    },
    {
        action = 'xraydesk', -- This is xray desk target
        coord = vector3(348.6, -579.48, 43.28),
        heading = 340,
        lenght = 2.6,
        width = 1.0,
        minz = 42.4,
        maxz = 44.0,
        distance = 1.5,
    },
    {
        action = 'managecomputer', -- This is manage computer target
        coord = vector3(308.56, -593.79, 43.28),
        heading = 315,
        lenght = 0.8,
        width = 0.8,
        minz = 42.8,
        maxz = 43.0,
        distance = 1.5,
        patientIcon = "fas fa-floppy-disk",
        patientLabel = "Patient registration system",
        billIcon = "fas fa-money-bill",
        billLabel = "Bill player"
    },
    {
        action = 'bloodcard', -- This is blood card target
        coord = vector3(311.8, -593.43, 43.28),
        heading = 339,
        lenght = 0.8,
        width = 1.0,
        minz = 42.8,
        maxz = 44.0,
        icon = "fa-solid fa-address-card",
        label = 'Buy blood card',
        distance = 1.5,
    },
}

-- # Armory Items

Config.Items = {
    label = "Ambulance Armory",
    slots = 8,
    items = {
        [1] = {
            name = "radio",
            price = 250,
            amount = 10,
            info = {},
            type = "item",
            slot = 1,
        },
        [2] = {
            name = "bandage",
            price = 10,
            amount = 10,
            info = {},
            type = "item",
            slot = 2,
        },
        [3] = {
            name = "weapon_flashlight",
            price = 30,
            amount = 10,
            info = {},
            type = "item",
            slot = 3,
        },
        [4] = {
            name = "weapon_stungun",
            price = 250,
            amount = 10,
            info = {},
            type = "item",
            slot = 4,
        },
        [5] = {
            name = "painkillers",
            price = 10,
            amount = 10,
            info = {},
            type = "item",
            slot = 5,
        },
        [6] = {
            name = "emptytube",
            price = 10,
            amount = 10,
            info = {},
            type = "item",
            slot = 6,
        },
        [7] = {
            name = "emptysyringe",
            price = 10,
            amount = 10,
            info = {},
            type = "item",
            slot = 7,
        },
        [8] = {
            name = "emptybaggy",
            price = 10,
            amount = 10,
            info = {},
            type = "item",
            slot = 8,
        },
    }
}

-- Elevator coords
Config.ElevatorInfos = {
    ['pillbox_1'] = {
        [-1] = {
            Coord = vector3(339.88, -586.28, 28.8),
            Heading = 340,
            Lenght = 0.2,
            Width = 0.4,
            Minz = 29.0,
            Maxz = 29.3,
            Distance = 1.5,
            Tpcoord = vector4(339.82, -584.66, 28.8, 75.64),
        },
        [1] = {
            Coord = vector3(325.57, -603.57, 43.28),
            Heading = 70,
            Lenght = 0.2,
            Width = 0.4,
            Minz = 43.5,
            Maxz = 43.8,
            Distance = 1.5,
            Tpcoord = vector4(327.29, -603.33, 43.28, 340.34),
        },
        [2] = {
            Coord = vector3(338.13, -583.64, 74.16),
            Heading = 340,
            Lenght = 2.8,
            Width = 0.4,
            Minz = 73.80,
            Maxz = 74.56,
            Distance = 1.5,
            Tpcoord = vector4(339.12, -584.01, 74.16, 251.08),
        },
    },
    -- If u want add more elevator like this.
}

--Garage config

Config.GarageEnabled = true -- If you want don't use garage change false

Config.GarageNpcInfos = {
    --Pillbox
    ["pillbox"] = {
        ["car"] = {
            coord = vector4(340.53, -582.82, 28.8, 72.09),
            hash = `s_m_y_valet_01`,
            type = "car",
        },
        ["helicopter"] = {
            coord = vector4(337.74, -586.7, 74.16, 249.22),
            hash = `s_m_y_valet_01`,
            type = "helicopter",
        },
    },
}

Config.GarageSpawnCoords = {
    --Pillbox
    ["pillbox"] = {
        ["car"] = vector4(332.05, -578.33, 28.8, 340.2),
        ["helicopter"] = vector4(352.6, -588.51, 74.16, 69.65)
    },
}

Config.GarageStoreVehicleCoords = {
    { coord = vector3(326.07, -588.53, 28.8), radius = 5.0 },
    { coord = vector3(318.63, -571.96, 28.8), radius = 5.0 },
}

Config.EmsVehicles = {
    ["car"] = {
        "ambulance",
        "lguard",
    },
    ["helicopter"] = {
        "polmav"
    },
}

-- # Npc Doctor Settings

Config.ReviveTime = 70000
Config.RestTime = 50000
Config.NpcDoctorCost = 150
Config.NpcDoctorMoney = "cash" -- | "cash", "bank"
Config.UseCheckOnlineDoc = true

Config.NpcDoctors = {
    { coord = vector4(312.77, -594.62, 43.28, 345.11), name = "John", model = `s_m_m_doctor_01` }, -- Gabz Pillbox
    -- If u want add more position like this ...
}

Config.Beds = {
    ["John"] = {
        dead = {
            vector4(326.84, -570.82, 43.26, 161.06),
            vector4(315.28, -566.61, 43.28, 155.03),
        },
        rest = {
            vector4(307.81, -581.69, 43.2, 340.96),
            vector4(311.12, -583.02, 43.2, 333.79),
            vector4(314.52, -584.28, 43.2, 337.71),
            vector4(317.74, -585.4, 43.2, 337.33),
            vector4(322.69, -587.23, 43.2, 339.7),
            vector4(324.22, -582.84, 43.2, 158.46),
            vector4(319.32, -580.99, 43.2, 162.94),
        }
    },
    -- If u want add more doctor like this
}

-- # Mr Desks

Config.MrCoord = {
    vector4(336.9098, -575.361, 43.186, 161.4),
}

-- # Xray Desks

Config.Xray = {
    vector4(348.4268, -579.877, 43.186, 162.51),
}

-- # Mr And Xray Desk Disable Keys ( When player lay on the desk disable this keys )

Config.DisableKeysForMrXrayDesks = {
    -- inputGroup | Key
    { 0, 24},
    { 0, 257},
    { 0, 25},
    { 0, 263},
    { 0, 56},
    { 0, 45},
    { 0, 22},
    { 0, 44},
    { 0, 37},
    { 0, 288},
    { 0, 289},
    { 0, 170},
    { 0, 167},
    { 0, 244},
    { 0, 0},
    { 0, 26},
    { 0, 73},
    { 2, 199},
    { 0, 59},
    { 0, 71},
    { 0, 72},
    { 0, 47},
    { 0, 264},
    { 0, 257},
    { 0, 140},
    { 0, 141},
    { 0, 142},
    { 0, 143},
    { 0, 75},
    { 0, 301},
    { 27, 75 },
    { 0, 157 },
    { 0, 158 },
    { 0, 160 },
    { 0, 164 },
    { 0, 165 },
}

-- # Mr Photos

Config.MrPhotos = {
    ["beyin"] = "nui://wert-ambulancejob/html/images/beyinmr.jpg",
    ["kalca"] = "nui://wert-ambulancejob/html/images/kalcamr.jpg",
    ["tabdomen"] ="nui://wert-ambulancejob/html/images/tabdomenmr.png",
    ["tchest"] = "nui://wert-ambulancejob/html/images/tchestmr.png",
    ["elbilek"] = "nui://wert-ambulancejob/html/images/elbilekmr.jpg",
    ["omuz"] = "nui://wert-ambulancejob/html/images/omuzmr.jpg",
    ["diz"] = "nui://wert-ambulancejob/html/images/dizmr.png",
    ["tboyun"] = "nui://wert-ambulancejob/html/images/tboyunmr.jpg",
    ["hipofiz"] = "nui://wert-ambulancejob/html/images/hipofizmr.png",
}

-- # Xray Photos

Config.XrayPhotos = {
    ["kafa"] = "nui://wert-ambulancejob/html/images/kafaxray.png",
    ["omuz"] = "nui://wert-ambulancejob/html/images/omuzxray.jpg",
    ["humerus"] = "nui://wert-ambulancejob/html/images/humerusxray.jpg",
    ["onkol"] = "nui://wert-ambulancejob/html/images/onkolxray.png",
    ["pelvis"] = "nui://wert-ambulancejob/html/images/pelvisxray.jpg",
    ["femur"] = "nui://wert-ambulancejob/html/images/femurxray.jpg",
    ["diz"] = "nui://wert-ambulancejob/html/images/dizxray.jpg",
    ["ayak"] = "nui://wert-ambulancejob/html/images/ayakxray.jpg",
    ["ciger"] = "nui://wert-ambulancejob/html/images/cigerxray.jpg",
}

-- # Blood Types

Config.PlayerBloodTypes = {
    'A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-',
}

-- # Blood Locations

Config.BloodPackageLocations = {
    {
        coord = vector3(311.74, -565.86, 43.28),
        width = 1.2,
        lenght = 0.8,
        heading = 340,
        minz = 42.28,
        maxz = 44.28,
        distance = 1.5,
    },
}

Config.BloodBankLocations = {
    {
        coord = vector3(309.95, -560.44, 43.28),
        width = 0.8,
        lenght = 0.8,
        heading = 340,
        minz = 42.28,
        maxz = 44.28,
        distance = 1.5,
    },
}

Config.TakeBloodSettings = {
    duration = 8000,
    anim = { dict = 'rcmpaparazzo1ig_4', clip = 'miranda_shooting_up', flag = 49 },
    prop = { model = `prop_syringe_01`, bone = 28422, pos = vec3(0.0, 0.0, 0.0), rot = vec3(0.0, 0.0, 0.0)}
}

Config.PackageBloodSettings = {
    duration = 5000,
    anim = { dict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@', clip = 'machinic_loop_mechandplayer', flag = 49 },
}
local myCoreObj = exports['qb-core']:GetCoreObject()

function CustomNotifyVariation(text, style, time)
    if Config.OxLib then
        lib.notify({ title = 'Hospital', description = text, type = style, duration = time })
    else
        myCoreObj.Functions.Notify(text, style, time)
    end
end

function CustomTextUI(show, text)
    if show then
        if Config.OxLib then
            lib.showTextUI(text)
        else
            exports['qb-core']:DrawText(text, 'left')
        end
    else
        if Config.OxLib then
            lib.hideTextUI()
        else
            exports['qb-core']:HideText()
        end
    end
end

function CustomEntityTarget(entity, options)
    if Config.TargetSystem == 'qb-target' then
        exports["qb-target"]:AddTargetEntity(entity, { options = options, distance = 1.5 })
    elseif Config.TargetSystem == 'ox_target' then
        exports.ox_target:addLocalEntity(entity, options)
    end
end

function CustomTargetAddBoxZone(zoneName, row, options)
    if Config.TargetSystem == 'qb-target' then
        exports['qb-target']:AddBoxZone(zoneName, row.coord, row.lenght, row.width, {
            name = zoneName,
            heading = row.heading,
            debugPoly = Config.DebugPoly,
            minZ = row.minz,
            maxZ = row.maxz,
        }, { options = options, distance = row.distance })
    elseif Config.TargetSystem == 'ox_target' then
        exports.ox_target:addBoxZone({
            name = zoneName,
            debug = Config.DebugPoly,
            coords = row.coord,
            rotation = row.heading,
            size = vector3(row.lenght, row.width, row.width),
            options = options
        })
    end
end

function CustomTargetAddModel(models, options)
    if Config.TargetSystem == 'qb-target' then
        exports["qb-target"]:AddTargetModel(models, { options = options, distance = 1.5 })
    elseif Config.TargetSystem == 'ox_target' then
        exports.ox_target:addModel(models, options)
    end
end

function CustomProgressbar(data, cb)
    if Config.OxLib then
        if lib.progressBar({
            duration = data.time,
            label = data.label,
            useWhileDead = false,
            canCancel = true,
            disable = {
                move = data.move,
                combat = data.combat,
                mouse = data.mouse,
                car = data.car,
            },
            anim = data.anim,
            prop = data.prop,
        }) then
            cb('true') 
        else
            cb('false')
        end
    else
        if data.anim then
            data.anim.animDict = data.anim.dict
            data.anim.anim = data.anim.clip
            data.anim.flags = data.anim.flag
        end
        if data.prop then
            data.prop.coords = data.prop.pos
            data.prop.rotation = data.prop.rot
        end
        myCoreObj.Functions.Progressbar(data.id, data.label, data.time, false, true, {
            disableMovement = data.move,
            disableCarMovement = data.car,
            disableMouse = data.mouse,
            disableCombat = data.combat,
        }, data.anim or {}, data.prop or {}, {}, function()
            cb('true')
        end, function()
            cb('false')
        end)
    end
end

function CustomGiveVehicleKey(veh, plate)
    -- If u use another system u can edit it
    TriggerEvent('vehiclekeys:client:SetOwner', plate)
end

function SetFuelAddonExport(veh, fuel)
    -- If you use another fuel system you can edit here
    if GetResourceState('LegacyFuel') == 'started' then exports['LegacyFuel']:SetFuel(veh, fuel) end
end

function CustomOpenBossMenu()
    TriggerEvent("qb-bossmenu:client:OpenMenu")
end

-- # Events

RegisterNetEvent('wert-ambulancejob:client:custom-notify-variation', CustomNotifyVariation)

local listenForKey = false
local createdPeds = {}

-- # Functions

local function WertCustomLoadModel(model)
    if HasModelLoaded(model) then return end
    RequestModel(model)
    while not HasModelLoaded(model) do
        Wait(0)
    end
end

local function WertCreateSystemPed(model, coord)
    local npc = CreatePed(2, model, coord.x, coord.y, coord.z - 1.0, coord.w, false, true)
    SetBlockingOfNonTemporaryEvents(npc, true)
    SetPedDiesWhenInjured(npc, false)
    SetPedCanPlayAmbientAnims(npc, true)
    SetPedCanRagdollFromPlayerImpact(npc, false)
    SetEntityInvincible(npc, true)
    FreezeEntityPosition(npc, true)
    createdPeds[#createdPeds+1] = npc
    return npc
end

-- # Events

RegisterNetEvent('wert-ambulancejob:client:open-custom-stash', function()
    if Config.QBInventoryNew then
        TriggerServerEvent('wert-ambulancejob:server:open-custom-stash')
    elseif Config.OxInventory then
        exports.ox_inventory:openInventory('stash', { id = "EmsStash" })
    else
        TriggerEvent("inventory:client:SetCurrentStash", "EmsStash")
	    TriggerServerEvent("inventory:server:OpenInventory", "stash", "EmsStash", { maxweight = 2000000, slots = 100 })
    end
end)

RegisterNetEvent('wert-ambulancejob:client:open-custom-shop', function()
    if Config.QBInventoryNew then
        TriggerServerEvent('wert-ambulancejob:server:open-custom-shop')
    elseif Config.OxInventory then
        exports.ox_inventory:openInventory('shop', {type = "ambulance", id = 1})
    else
        TriggerServerEvent("inventory:server:OpenInventory", "shop", "ambulance", Config.Items)
    end
end)

-- # Threads

CreateThread(function()
    Wait(1000)
    for i = 1, #Config.TargetInfos do
        local row = Config.TargetInfos[i]
        local zoneName = row.action .. '_' .. i
        local targetOptions = {}
        if row.action == 'managecomputer' then
            targetOptions[#targetOptions+1] = {
                type = "client",
                event = "wert-ambulancejob:patient-save",
                icon = row.patientIcon,
                label = row.patientLabel,
                job = "ambulance",
                distance = 1.5
            }
            if Config.UseBillSystem then
                targetOptions[#targetOptions+1] = {
                    type = "client",
                    event = "wert-ambulancejob:ambulance-bill",
                    icon = row.billIcon,
                    label = row.billLabel,
                    job = "ambulance",
                    distance = 1.5
                }
            end
        elseif row.action == 'armoryandstash' then
            targetOptions = {
                {
                    type = "client",
                    event = "wert-ambulancejob:client:open-custom-shop",
                    icon = row.armoryIcon,
                    label = row.armoryLabel,
                    job = "ambulance",
                    distance = 1.5
                },
                {
                    type = "client",
                    event = "wert-ambulancejob:client:open-custom-stash",
                    icon = row.stashIcon,
                    label = row.stashLabel,
                    job = "ambulance",
                    distance = 1.5
                }
            }
        elseif row.action == 'mrdesk' then
            targetOptions = {
                {
                    type = "client",
                    icon = "fas fa-bed",
                    label = "MRI Desk",
                    action = function(entity) TriggerEvent("wert-ambulancejob:mr", "yat") end,
                    onSelect = function(entity) TriggerEvent("wert-ambulancejob:mr", "yat") end,
                    canInteract = function(entity) if not yatakta then return true else return false end end,
                    distance = 1.5
                },
                {
                    type = "client",
                    icon = "fas fa-bed",
                    label = "Get Up",
                    action = function(entity) TriggerEvent("wert-ambulancejob:mr", "kalk") end,
                    onSelect = function(entity) TriggerEvent("wert-ambulancejob:mr", "kalk") end,
                    canInteract = function(entity) if yatakta then return true else return false end end,
                    distance = 1.5
                }
            }
        elseif row.action == 'xraydesk' then
            targetOptions = {
                {
                    type = "client",
                    icon = "fas fa-bed",
                    label = "XRAY Desk",
                    action = function(entity) TriggerEvent("wert-ambulancejob:xray", "yat") end,
                    onSelect = function(entity) TriggerEvent("wert-ambulancejob:xray", "yat") end,
                    canInteract = function(entity) if not yatakta then return true else return false end end,
                    distance = 1.5
                },
                {
                    type = "client",
                    icon = "fas fa-bed",
                    label = "Get Up",
                    action = function(entity) TriggerEvent("wert-ambulancejob:xray", "kalk") end,
                    onSelect = function(entity) TriggerEvent("wert-ambulancejob:xray", "kalk") end,
                    canInteract = function(entity) if yatakta then return true else return false end end,
                    distance = 1.5
                }
            }
        else
            targetOptions[#targetOptions+1] = {
                type = "client",
                event = "wert-ambulancejob:client:newTarget",
                icon = row.icon,
                label = row.label,
                job = "ambulance",
                ambTTaction = row.action,
                distance = 1.5
            }
        end
        CustomTargetAddBoxZone(zoneName, row, targetOptions)
    end

    -- # Coffe Machine
    if Config.EnableCoffeSystem then
        CustomTargetAddModel(Config.CoffeMachineModels, {
            {
                type = "client",
                event = "wert-ambulancejob:make-coffee",
                icon = "fas fa-beer-mug-empty",
                label = "Coffe Machine",
                distance = 1.5
            },
        })
    end
    
    -- # Water Cooler
    if Config.EnableWaterCoolerSystem then
        CustomTargetAddModel(Config.WaterCoolerModels, {
            {
                type = "client",
                event = "wert-ambulancejob:sebil",
                icon = "fas fa-droplet",
                label = "Water Cooler",
                distance = 1.5
            },
        })
    end

    
    -- # Elevators
    for elevatorIdentifier in pairs(Config.ElevatorInfos) do
        local elevatorData = Config.ElevatorInfos[elevatorIdentifier]
        for floor, isData in pairs(elevatorData) do
            CustomTargetAddBoxZone(floor.."EMSElevator_" .. elevatorIdentifier, {
                coord = isData.Coord,
                lenght = isData.Lenght,
                width = isData.Width,
                heading = isData.Heading,
                coord = isData.Coord,
                minz = isData.Minz,
                maxz = isData.Maxz,
                distance = isData.Distance
            }, {
                {
                    type = "client",
                    place = "Hospital",
                    icon = "fas fa-door-open",
                    label = "Elevator",
                    action = function(entity) TriggerEvent("wert-ambulancejob:use-elevator", floor, elevatorIdentifier) end,
                    onSelect = function(entity) TriggerEvent("wert-ambulancejob:use-elevator", floor, elevatorIdentifier) end,
                },
            })
        end
    end

    -- # Npc Doctors
    for i = 1, #Config.NpcDoctors do
        local row = Config.NpcDoctors[i]
        WertCustomLoadModel(row.model)
        local hospitalped = WertCreateSystemPed(row.model, row.coord)
        Wait(100)
        CustomEntityTarget(hospitalped, {
            {
                place = "NpcDoctor",
                icon = "fas fa-stethoscope",
                label = row.name .. " Doctor",
                action = function() TriggerEvent('wert-ambulancejob:client:npc-doctor-menu', row.name) end,
                onSelect = function() TriggerEvent('wert-ambulancejob:client:npc-doctor-menu', row.name) end,
            },
        })
    end

    -- # Blood targets
    for i = 1, #Config.BloodPackageLocations do
        local row = Config.BloodPackageLocations[i]
        CustomTargetAddBoxZone('EMSBloodPackaged'..i, row, {
            {
                type = 'client',
                icon = 'fa-solid fa-droplet',
                label = 'Packaged blood',
                item = 'bloodtube',
                action = function(entity) TriggerServerEvent('wert-ambulancejob:kan-paket') end,
                onSelect = function(entity) TriggerServerEvent('wert-ambulancejob:kan-paket') end,
            },
        })
    end
    
    for i = 1, #Config.BloodBankLocations do
        local row = Config.BloodPackageLocations[i]
        CustomTargetAddBoxZone('EMSBloodBank'..i, row, {
            {
                type = 'client',
                icon = 'fa-solid fa-server',
                label = 'Load blood in the bank',
                item = 'bloodbag',
                action = function(entity) TriggerServerEvent('wert-ambulancejob:kan-load-bank') end,
                onSelect = function(entity) TriggerServerEvent('wert-ambulancejob:kan-load-bank') end,
            },
            {
                type = 'client',
                icon = 'fa-solid fa-hand-holding-heart',
                label = 'Take blood in the bank',
                event = 'wert-ambulancejob:take-blood-in-bank'
            },
        })
    end

    -- # Garage
    if Config.GarageEnabled then
        for garageIdentifier in pairs(Config.GarageNpcInfos) do
            local row = Config.GarageNpcInfos[garageIdentifier]
            for k,v in pairs(row) do
                WertCustomLoadModel(row.hash)
                local garageped = WertCreateSystemPed(row.hash, row.coord)
                Wait(100)
                CustomEntityTarget(garageped, {
                    {
                        place = "WertGarageAmbulance",
                        icon = "fas fa-warehouse",
                        label = "Garage attendant ",
                        job = "ambulance",
                        action = function(entity) TriggerEvent("wert-ambulancejob:client:garage-menu", garageIdentifier, k) end,
                        onSelect = function() TriggerEvent("wert-ambulancejob:client:garage-menu", garageIdentifier, k) end,
                    },
                })
            end
        end

        
        local storeZones = {}
        for i = 1, #Config.GarageStoreVehicleCoords do
            local row = Config.GarageStoreVehicleCoords[i]
            storeZones[#storeZones+1] = CircleZone:Create(row.coord, row.radius, { name = 'garageStoreAmbulancejob' .. i, debugPoly = Config.DebugPoly, useZ = true })
        end
        if #storeZones > 0 then
            local storeComboZonbe = ComboZone:Create(garageZones, { name = 'garageStoreAmbulancejobCombo', debugPoly = Config.DebugPoly })
            storeComboZonbe:onPlayerInOut(function(isPointInside, _, zone)
                if isPointInside then
                    listenForKey = true
                    CreateThread(function()
                        while listenForKey do
                            Wait(1)
                            if IsControlJustReleased(0, 38) and IsPedInAnyVehicle(PlayerPedId()) and GetPedInVehicleSeat(GetVehiclePedIsIn(PlayerPedId(), false), -1) == PlayerPedId() then
                                listenForKey = false
                                CustomTextUI(false)
                                TriggerEvent('wert-ambulancejob:client:store-vehicle')
                                break
                            end
                        end
                    end)
                    CustomTextUI(true, '[E] Store Vehicle (EMS)')
                else
                    listenForKey = false
                    CustomTextUI(false)
                end
            end)
        end
    end
end)

AddEventHandler('onResourceStop', function(resource)
    if resource == GetCurrentResourceName() then
        for i = 1, #createdPeds do DeleteEntity(createdPeds[i]) end -- Clear npc doctor peds
    end
end)
LANG = {
    ["en"] = {
        ["sendbill"] = "Bill arrived!",
        ["doctormenu"] = "Pillbox hospital",
        ["doctorquestion"] = "Do you want to be treated ?",
        ["doctor"] = "Doctor :",
        ["npcdoctorprogress1"] = "You are being treated",
        ["npcdoctorprogress2"] = "Resting...",
        ["npcdoctorfinish"] = "Doctors finished treatment",
        ["npcdoctorcancel"] = "Treatment cancelled",
        ["garagemenu"] = "Garage menu",
        ["vehiclestored"] = "Vehicle stored!",
        ["bloodprogress1"] = "Taking a blood sample...",
        ["closestplayererror"] = "There is no one nearby!",
        ["bloodprogress2"] = "Package process...",
        ["bloodupload"] = "Blood load",
        ["selectbillplayer"] = "To whom do you want to send an invoice ?",
        ["billheader"] = "Bill",
        ["confirm"] = "Confirm",
        ["billprice"] = "Price ($)",
        ["billinvalid"] = "Invalid value",
        ["selectplan"] = "Select plan",
        ["selectpatient"] = "Select patient",
        ["invalidplan"] = "Please select a valid plan",
        ["mrprogress"] = "MR...",
        ["xrayprogress"] = "XRAY...",
        ["waterprogress"] = "Drinking...",
        ["coffeprogress"] = "The coffee machine is running...",
        ["preparingcoffe"] = "Preparing coffee...",
        ["coffeready"] = "Your coffee is ready",
        ["gotcoffe"] = "You got the coffee",
        ["alreadycoffe"] = "You already prepare coffe",
        ["selectfloor"] = "Select floor",
        ["floornum"] = "st Floor",
        ["exit"] = "Exit",
        ["elevatorprogress"] = "Elevator call...",
        ["cardprogressbar"] = 'Receiving card...',
        ["casherror"] = 'Not enough cash!',
        ["billsended"] = "Bill send price : ",
        ["itemerror"] = "Not enough item",
        ["bloodbank"] = "Blood bank",
        ["bloodamounterror"] = "Not enough blood",
        ["bloodmenuamount"] = "Amount :",
        ["bloodtaked"] = "Blood take from bank",
        ["tubeerror"] = "You dont have tube",
        ["notenoughmoney"] = "Not enough money",
        ["doctorsonlnie"] = "Doctor in city!",
        ["noemptybagg"] = "You dont have empty blood bag!",
        ['bloodtubenothavedata'] = "The blood found in the tube does not belong to anyone. Please take the blood from a player.",
        ['takevehicledescription'] = "Take vehicle from garage",
        ['clickForBill'] = 'Click for create bill!',
        ['selectAndStartAction'] = 'Click for start with this patient!',
    },
}

Installation complete

PreviousWert HousesNextWert BodyCam (For civilians and jobs)

Last updated 6 days ago