-
Notifications
You must be signed in to change notification settings - Fork 9
API Reference
Artmines edited this page Nov 6, 2025
·
2 revisions
Complete reference for all events and exports available to developers.
-- Receive updated wounds from server
RegisterNetEvent('QC-AdvancedMedic:client:SyncWoundData')
-- Load wounds on spawn
RegisterNetEvent('QC-AdvancedMedic:client:LoadWounds')
-- Admin command clear
RegisterNetEvent('QC-AdvancedMedic:client:ClearAllWounds')-- Server tells client to apply bandage
RegisterNetEvent('QC-AdvancedMedic:client:ApplyBandage')
-- Server tells client to apply tourniquet
RegisterNetEvent('QC-AdvancedMedic:client:ApplyTourniquet')
-- Server tells client to give medicine
RegisterNetEvent('QC-AdvancedMedic:client:AdministreMedicine')
-- Server tells client to give injection
RegisterNetEvent('QC-AdvancedMedic:client:GiveInjection')
-- Remove specific treatment
RegisterNetEvent('QC-AdvancedMedic:client:RemoveTreatment')
-- Load treatments on spawn
RegisterNetEvent('QC-AdvancedMedic:client:LoadTreatments')-- Load infections on spawn
RegisterNetEvent('QC-AdvancedMedic:client:LoadInfections')
-- Apply infection cure
RegisterNetEvent('QC-AdvancedMedic:client:TreatInfection')
-- Sync infection data
RegisterNetEvent('QC-AdvancedMedic:client:SyncInfectionData')-- Activate death camera
RegisterNetEvent('QC-AdvancedMedic:client:DeathCam')
-- Player respawn
RegisterNetEvent('QC-AdvancedMedic:client:revive')
-- Admin revive
RegisterNetEvent('QC-AdvancedMedic:client:adminRevive')
-- Medic revive
RegisterNetEvent('QC-AdvancedMedic:client:playerRevive')-- Show medic inspection UI
RegisterNetEvent('QC-AdvancedMedic:client:ShowInspectionPanel')
-- Hide inspection UI
RegisterNetEvent('QC-AdvancedMedic:client:HideInspectionPanel')-- Tool usage result from server (success/failure with inventory validation)
RegisterNetEvent('QC-AdvancedMedic:client:ToolUsageResult')
-- Updated medic inventory after tool usage
RegisterNetEvent('QC-AdvancedMedic:client:UpdateMedicInventory')NUI Callback:
-- Client-side callback for NUI doctor bag tool usage
RegisterNUICallback('medical-action', function(data, cb)
-- data.action = 'use-tool'
-- data.target = tool action (e.g., 'smelling-salts', 'stethoscope', 'laudanum')
-- data.playerId = target patient ID
cb({status = 'pending', message = 'Processing...'})
end)Tool Actions:
-
smelling-salts→revive_unconscious(consumable) -
stethoscope→check_heart_lungs(non-consumable) -
thermometer→check_temperature(non-consumable) -
field-kit→emergency_surgery(consumable) -
laudanum→medicine_laudanum(consumable, routes through medicine system) -
whiskey→medicine_whiskey(consumable, routes through medicine system)
-- Client sends wound changes
RegisterNetEvent('QC-AdvancedMedic:server:UpdateWoundData')
-- Client sends treatment changes
RegisterNetEvent('QC-AdvancedMedic:server:UpdateTreatmentData')
-- Client sends infection changes
RegisterNetEvent('QC-AdvancedMedic:server:UpdateInfectionData')
-- Client requests all medical data
RegisterNetEvent('QC-AdvancedMedic:server:LoadMedicalData')-- Medic treats patient
RegisterNetEvent('QC-AdvancedMedic:server:ApplyTreatment')
-- Log treatment removal
RegisterNetEvent('QC-AdvancedMedic:server:TreatmentRemoved')
-- Medic treats infection
RegisterNetEvent('QC-AdvancedMedic:server:TreatInfection')-- Medic starts inspection
RegisterNetEvent('QC-AdvancedMedic:server:StartMedicalInspection')
-- Medic finishes inspection
RegisterNetEvent('QC-AdvancedMedic:server:CompleteMedicalInspection')
-- Request vitals data
RegisterNetEvent('QC-AdvancedMedic:server:CheckVitals')-- Revive command
RegisterNetEvent('QC-AdvancedMedic:server:RevivePlayer')
-- Set player health
RegisterNetEvent('QC-AdvancedMedic:server:SetHealth')
-- Death inventory wipe
RegisterNetEvent('QC-AdvancedMedic:server:deathactions')-- Use doctor bag tool (validates inventory, removes item if consumable)
RegisterNetEvent('QC-AdvancedMedic:server:UseDoctorBagTool')
-- Parameters: toolAction (string), targetPlayerId (string)
-- Triggers: QC-AdvancedMedic:client:ToolUsageResult on success/failure
-- Refresh medic's inventory after item usage
RegisterNetEvent('QC-AdvancedMedic:server:RefreshMedicInventory')
-- Sends updated inventory to client via UpdateMedicInventory eventFlow:
- Medic opens doctor bag (inventory checked when
/inspectcommand runs) - Medic clicks tool →
medical-actionNUI callback →UseDoctorBagToolserver event - Server validates inventory:
-
Consumable items: Attempts
RemoveItem(), returns failure if not in inventory -
Non-consumable items: Checks
GetItemByName(), returns failure if missing - Medicine items: Routes to existing medicine system after inventory check
-
Consumable items: Attempts
- Server returns result via
ToolUsageResultevent - Client displays notification (success/failure message)
- If inventory changed, client triggers
RefreshMedicInventoryto update NUI
-- Get all wounds
local wounds = exports['QC-AdvancedMedic']:GetPlayerWounds()
-- Get total bleeding level
local bleeding = exports['QC-AdvancedMedic']:GetBleedingLevel()
-- Add a wound manually
exports['QC-AdvancedMedic']:AddWound(bodyPart, pain, bleed, weapon)
-- Remove a wound
exports['QC-AdvancedMedic']:RemoveWound(bodyPart)
-- Clear all wounds
exports['QC-AdvancedMedic']:ClearAllWounds()Example:
-- Check if player is bleeding
local bleeding = exports['QC-AdvancedMedic']:GetBleedingLevel()
if bleeding > 5 then
print("Player is severely bleeding!")
end
-- Get all wounds
local wounds = exports['QC-AdvancedMedic']:GetPlayerWounds()
for bodyPart, wound in pairs(wounds) do
if not wound.isScar then
print(string.format("%s: Pain %d, Bleeding %d",
bodyPart, wound.painLevel, wound.bleedingLevel))
end
end-- Apply bandage
exports['QC-AdvancedMedic']:ApplyBandage(bodyPart, type, appliedBy)
-- Apply tourniquet
exports['QC-AdvancedMedic']:ApplyTourniquet(bodyPart, type, appliedBy)
-- Give medicine
exports['QC-AdvancedMedic']:AdministreMedicine(medicineType, appliedBy)
-- Give injection
exports['QC-AdvancedMedic']:GiveInjection(injectionType, appliedBy)Example:
-- Apply cotton bandage to head
exports['QC-AdvancedMedic']:ApplyBandage('HEAD', 'cotton', GetPlayerServerId(PlayerId()))
-- Give morphine
exports['QC-AdvancedMedic']:AdministreMedicine('medicine_morphine', GetPlayerServerId(PlayerId()))-- Get infection data for body part
local infection = exports['QC-AdvancedMedic']:GetInfectionData(bodyPart)
-- Treat infection
exports['QC-AdvancedMedic']:TreatInfection(bodyPart, item)
-- Get cure progress
local progress = exports['QC-AdvancedMedic']:GetCureProgress(bodyPart)Example:
-- Check if body part is infected
local infection = exports['QC-AdvancedMedic']:GetInfectionData('LARM')
if infection then
print(string.format("Infection Stage: %d", infection.stage))
print(string.format("Cure Progress: %d%%", infection.metadata.cureProgress or 0))
end-- Trigger healing check manually
exports['QC-AdvancedMedic']:ProcessWoundHealing()
-- Get healing timers
local timers = exports['QC-AdvancedMedic']:GetHealingTimers()-- Save wound data (UPSERT)
exports['QC-AdvancedMedic']:SaveWoundData(citizenid, woundData)
-- Load wound data
local wounds = exports['QC-AdvancedMedic']:LoadWoundData(citizenid)
-- Save treatment data
exports['QC-AdvancedMedic']:SaveTreatmentData(citizenid, treatmentData)
-- Save infection data
exports['QC-AdvancedMedic']:SaveInfectionData(citizenid, infectionData)
-- Get complete medical profile
local profile = exports['QC-AdvancedMedic']:GetCompleteMedicalProfile(citizenid)Example:
-- Get complete medical profile
local profile = exports['QC-AdvancedMedic']:GetCompleteMedicalProfile(citizenid)
print(json.encode(profile.wounds))
print(json.encode(profile.treatments))
print(json.encode(profile.infections))
print(json.encode(profile.fractures))
print(json.encode(profile.history))-- Log medical event
exports['QC-AdvancedMedic']:LogMedicalEvent(citizenid, eventType, bodyPart, details, performedBy)
-- Get medical history
local history = exports['QC-AdvancedMedic']:GetMedicalHistory(citizenid)Event Types:
wound_createdwound_scarredtreatment_appliedtreatment_removedinfection_startedinfection_curedmedical_inspectionadmin_clear_woundsfracture_createdfracture_healed
Example:
-- Log a custom medical event
exports['QC-AdvancedMedic']:LogMedicalEvent(
citizenid,
'treatment_applied',
'HEAD',
json.encode({
treatmentType = 'bandage',
itemType = 'cotton',
appliedBy = medicCitizenid
}),
medicCitizenid
)-- Create a scar
exports['QC-AdvancedMedic']:CreateScar(citizenid, bodyPart, scarData)
-- Get player scars
local scars = exports['QC-AdvancedMedic']:GetPlayerScars(citizenid)Example:
-- Get all scars for player
local scars = exports['QC-AdvancedMedic']:GetPlayerScars(citizenid)
for bodyPart, scar in pairs(scars) do
print(string.format("%s: %s", bodyPart, scar.metadata.description))
end-- Check if job is a medic job
local isMedic = IsMedicJob(jobName)Example:
local Player = RSGCore.Functions.GetPlayer(source)
if IsMedicJob(Player.PlayerData.job.name) then
print("Player is a medic!")
end-- In your external resource
RegisterCommand('checkinjury', function()
local wounds = exports['QC-AdvancedMedic']:GetPlayerWounds()
local bleeding = exports['QC-AdvancedMedic']:GetBleedingLevel()
if bleeding > 3 then
print("You're bleeding badly!")
end
for bodyPart, wound in pairs(wounds) do
if not wound.isScar then
print(string.format("%s: Pain %d, Bleeding %d",
bodyPart, wound.painLevel, wound.bleedingLevel))
end
end
end)-- In your custom medic script
RegisterCommand('quickheal', function()
local playerId = PlayerId()
local serverId = GetPlayerServerId(playerId)
-- Apply bandage to head
exports['QC-AdvancedMedic']:ApplyBandage('HEAD', 'sterile', serverId)
-- Give morphine for pain
exports['QC-AdvancedMedic']:AdministreMedicine('medicine_morphine', serverId)
end)-- In your survival script
CreateThread(function()
while true do
Wait(60000) -- Check every minute
local wounds = exports['QC-AdvancedMedic']:GetPlayerWounds()
for bodyPart, wound in pairs(wounds) do
local infection = exports['QC-AdvancedMedic']:GetInfectionData(bodyPart)
if infection and infection.stage >= 3 then
-- Trigger fever effects, hallucinations, etc.
print(string.format("Severe infection in %s!", bodyPart))
end
end
end
end)-- In your admin panel
RegisterCommand('medreport', function(source, args)
local targetId = tonumber(args[1])
if not targetId then return end
local Player = RSGCore.Functions.GetPlayer(targetId)
if not Player then return end
local profile = exports['QC-AdvancedMedic']:GetCompleteMedicalProfile(Player.PlayerData.citizenid)
-- Count wounds
local woundCount = 0
for _ in pairs(profile.wounds or {}) do
woundCount = woundCount + 1
end
-- Count infections
local infectionCount = 0
for _ in pairs(profile.infections or {}) do
infectionCount = infectionCount + 1
end
TriggerClientEvent('chat:addMessage', source, {
args = {
'Medical Report',
string.format('Wounds: %d | Infections: %d', woundCount, infectionCount)
}
})
end, true) -- Admin onlyv0.3.1-alpha