Medical
Tell whether the local player is down (dead or in last stand), whatever death script the server runs.
Death scripts keep a downed player's ped alive so they can animate it (lying on the ground, crawling, last stand). That means GTA's own IsEntityDead often says "alive" for a player who is down. ai-core's medical layer asks the death script the server runs (ai-death, qbx_medical, ars_ambulancejob, qb-ambulancejob, esx_ambulancejob, tgiann-ambulance, wasabi_ambulance, osp_ambulance, brutal_ambulancejob) and tells every resource the same answer.
IsDead
Tells whether the local player is down right now, dead or in last stand, in whichever death script runs. Use it before an action a downed player must not do (opening a menu, using an item, entering a vehicle).
Side: Client · Waits: no
IsDead(): booleanlocal down = exports['ai-core']:IsDead() -- booleanParameters
None.
Returns
boolean: true while the player is down in the active death script. false when they are up, or when no supported death script runs.
The lib's medical.isDead() (TypeScript) answers true also when GTA itself says the ped is dead, which covers servers without a death script. It reads the export once and then follows the client event ai-core:client:dead, so calling it often costs nothing. In Lua there is no helper: call the export, or follow the event.
Example
import { medical, notify } from "@aicore-fivem/lib/client";
import { Locale } from "common";
RegisterCommand(
"phone",
() => {
if (medical.isDead()) return notify(Locale("CANT_WHILE_DOWN"), "error");
SetNuiFocus(true, true);
SendNUIMessage({ action: "open" });
},
false,
);
// Close the phone the moment the player goes down.
medical.onChange((dead) => {
if (!dead) return;
SetNuiFocus(false, false);
SendNUIMessage({ action: "close" });
});This is the local player's own state, for what they see. Server decisions (reviving, looting a body, refusing an action) check the server's medical exports, never a client's answer.