FiveM Docs
Addons

esx_ambulancejob

Set up esx_ambulancejob for ESX Legacy. EMS job with revive, heal, pharmacy and job vehicles, plus config keys, server events, callbacks and common issues.

esx_ambulancejob adds a playable EMS job to ESX Legacy: paramedics can revive dead players, heal injured ones, take medical supplies from the hospital pharmacy and buy ambulances and helicopters. Death itself (death screen, bleedout, respawn) is handled by esx_death; this resource only adds the medic side.

Overview

Resourceesx_ambulancejob (version 1.0.2)
Sideclient + server
Dependenciesesx_lib, esx_death, es_extended, esx_skin, esx_vehicleshop
Optionalesx_society (boss menu, society account), esx_phone (registers the ambulance number)
Job nameambulance (grades ambulance, doctor, chief_doctor, boss)
Itemsmedikit, bandage

In-game features:

  • F6 menu (/ambulance command, rebindable key mapping): revive, small heal (bandage), big heal (medikit), put a patient in the closest vehicle, search a nearby dead player.
  • Hospital markers: cloakroom (go on and off duty in uniform), boss actions, pharmacy, vehicle and helicopter garages, fast-travel elevators.
  • Dead player blips for on-duty medics, plus a distress blip when a downed player sends a distress signal through esx_death.
  • Usable items: medikit restores full health, bandage restores one eighth of max health.

Installation

Import the SQL

Run esx_ambulancejob.sql. It creates the ambulance job and its 4 grades, the society_ambulance account, inventory and datastore, and the medikit and bandage items. Translated variants live in localization/.

Check the users column

The SQL also runs ALTER TABLE users ADD is_dead. If esx_death already created that column (it does with Config.AutoMigrate = true), the statement fails with a duplicate column error. Remove that last statement before importing, or run the file statement by statement.

Ensure the resource

Start it after its dependencies:

server.cfg
ensure esx_lib
ensure es_extended
ensure esx_skin
ensure esx_vehicleshop
ensure esx_death
ensure esx_society
ensure esx_ambulancejob

Configuration

All keys live in config.lua.

KeyDefaultDescription
Config.DrawDistance10.0Distance at which markers are drawn.
Config.DebugfalsePrints client debug messages (duty, blips, healing).
Config.DebugDeathfalsePrints server debug lines for every revive attempt, including why it was blocked.
Config.Marker{type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false}Default marker style for hospital points.
Config.ReviveReward700Cash paid to the medic per successful revive. 0 disables the reward.
Config.LoadIpltrueLoads the morgue IPL. Disable if you use an IPL loader such as bob74_ipl.
Config.LocaleGetConvar('esx:locale', 'en')Language.
Config.DistressBlip{Sprite = 310, Color = 48, Scale = 2.0}Blip shown to medics for a distress call.
Config.EnablePlayerManagementfalseShows the esx_society boss menu for the boss grade.
Config.PharmacyItemsmedikit, bandageMenu entries { title = 'Medikit', item = 'medikit' }. Only medikit and bandage are accepted by the server.
Config.MaxPharmacyTake5Max amount per pharmacy request.
Config.PharmacyCooldown5000Cooldown between pharmacy requests in ms.
Config.HospitalsCentralLosSantosHospital definitions, see below.
Config.AuthorizedVehiclessee belowBuyable vehicles per type and grade.

Config.Hospitals

Each hospital has these fields:

FieldDescription
Blip{ coords, sprite, scale, color } map blip.
AmbulanceActionsList of vector3 points for the cloakroom / boss menu.
PharmaciesList of vector3 points. The server checks the medic is within 8 m of one.
Vehicles, HelicoptersList of { Spawner, InsideShop (vector4), Marker, SpawnPoints = {{ coords, heading, radius }} }.
FastTravels{ From, To = { coords, heading }, Marker } teleport on entering the marker.
FastTravelsPromptSame as FastTravels plus Prompt; the player must press the key.

Config.AuthorizedVehicles

Keyed by vehicle type (car, helicopter) and then by job grade name:

config.lua
Config.AuthorizedVehicles = {
    car = {
        ambulance = { { model = 'ambulance', price = 5000 } },
        boss = { { model = 'ambulance', price = 2000 } },
    },
    helicopter = {
        doctor = { { model = 'buzzard2', price = 150000 } },
    },
}

An entry can also carry a props table; it is merged into the vehicle properties saved in owned_vehicles. Purchased vehicles get an AMB plate prefix and are stored with job = 'ambulance'.

Removed keys

Config.EarlyRespawnTimer, Config.BleedoutTimer, Config.RespawnPoints, Config.RemoveWeaponsAfterRPDeath, Config.RemoveCashAfterRPDeath, Config.RemoveItemsAfterRPDeath, Config.EarlyRespawnFine* and the death camera zoom no longer exist here. They live in esx_death/config.lua.

Server events

These are net events, so any client can trigger them. Each one validates the caller on the server, which is why custom scripts should not bypass them.

esx_ambulancejob:revive

TriggerServerEvent('esx_ambulancejob:revive', targetServerId)
NameTypeDescription
targetServerIdnumberServer ID of the dead player.

Client-triggerable

Revives a player and pays Config.ReviveReward. The server requires: caller has job ambulance and is on duty, caller is not dead, 8 second rate limit, target within 8 m and dead (according to esx_death), caller owns a medikit (one is consumed). To revive from server code use exports.esx_death:Revive(target, reason) instead.

esx_ambulancejob:heal

TriggerServerEvent('esx_ambulancejob:heal', targetServerId, healType)
NameTypeDescription
targetServerIdnumberPlayer to heal (within 8 m).
healType'small' | 'big'small uses a bandage, big uses a medikit.

On-duty medics only, 3 second rate limit. On success the server sends esx_ambulancejob:heal to the target client.

esx_ambulancejob:putInVehicle

TriggerServerEvent('esx_ambulancejob:putInVehicle', targetServerId)

Warps the target (within 8 m) into the closest free seat of the nearest vehicle. On-duty medics only, 3 second rate limit.

esx_ambulancejob:giveItem

TriggerServerEvent('esx_ambulancejob:giveItem', itemName, amount)

Client-triggerable

Gives pharmacy items. The server only accepts medikit or bandage, an amount between 1 and Config.MaxPharmacyTake, an on-duty medic within 8 m of a pharmacy, and enforces Config.PharmacyCooldown. Rejected attempts are printed as a warning.

esx_ambulancejob:svsearch

TriggerServerEvent('esx_ambulancejob:svsearch')

Sends esx_ambulancejob:clsearch to every dead player within 3 m of the medic. esx_death handles that client event.

Client events

Sent by the server; listen to them if you build a custom MDT or HUD.

EventArgumentsWhen
esx_ambulancejob:healhealType, quietHeals the local ped (small = +1/8 max health, big = full).
esx_ambulancejob:useItemitemNamePlayer used a medikit or bandage.
esx_ambulancejob:putInVehiclenoneWarp into the nearest vehicle.
esx_ambulancejob:PlayerDeadplayerIdSent to all medics when esx_death marks a player dead.
esx_ambulancejob:PlayerNotDeadplayerIdSent to all medics when a player is no longer dead.
esx_ambulancejob:PlayerDistressedplayerId, coordsDistress signal from a downed player.
esx_ambulancejob:setDeadPlayersdeadPlayers, locationsLocal event that rebuilds the dead player blips.
client/mdt.lua
RegisterNetEvent('esx_ambulancejob:PlayerDistressed', function(playerId, coords)
    print(('Distress call from %s at %.1f, %.1f'):format(playerId, coords.x, coords.y))
end)

Server callbacks

Registered with xLib.callback.registerCompat, so they work with xLib.callback and ESX.TriggerServerCallback.

CallbackArgumentsReturns
esx_ambulancejob:getItemAmountitemCount of that item in the caller's inventory.
esx_ambulancejob:getDeadPlayersnonedeadPlayers, locations from esx_death (empty table if the caller is not an on-duty medic).
esx_ambulancejob:buyJobVehiclevehicleProps, typetrue when bought. Validates grade, price, money and distance to the shop.
esx_ambulancejob:storeNearbyVehicleplatesResult of es_extended:StoreJobVehicle.

Commands

CommandSideDescription
/ambulanceclientOpens the mobile EMS menu. Mapped to F6 by default (players can rebind it in the FiveM key settings). Only works for the ambulance job while alive.

Integration tips

  • Revive from other scripts: use the esx_death export on the server.

    server/main.lua
    local ok = exports.esx_death:Revive(playerId, 'admin')
    if ok then
        print(('Revived %s'):format(playerId))
    end
  • Duty: the server checks xPlayer.job.onDuty ~= false. If you use a duty script, set ESX duty through it so medics who are off duty cannot revive.

  • Uniforms come from the skin_male / skin_female columns of job_grades and are applied through esx_skin.

  • Society money: the resource registers society_ambulance with esx_society when that resource is present.

Common issues

  • Duplicate column is_dead when importing the SQL: the column already exists (esx_death). Skip the ALTER TABLE statement.
  • Revive or heal does nothing: the player is not on duty, has no medikit/bandage, is too far away, or hit the rate limit. Turn on Config.DebugDeath.
  • F6 does nothing: the key was rebound in the FiveM settings, or ESX.PlayerData.dead is true.
  • Pharmacy returns nothing: you added an item to Config.PharmacyItems that is not medikit or bandage, or requested more than Config.MaxPharmacyTake.

Frequently asked questions

Independent documentation

esx-fivem.com is a community project and is not affiliated with the ESX Framework team. Facts on this page were checked against the upstream source. Official resources: docs.esx-framework.org and github.com/esx-framework.
Edit on GitHub

Last updated on

On this page