Exports & Events
exports['kartik-firefighterjob']:ExportName(...)Server
Firefighters
exports['kartik-firefighterjob']:IsFirefighter(src) -- has a fire job (Config.Jobs)
exports['kartik-firefighterjob']:IsOnDuty(src)
exports['kartik-firefighterjob']:GetStation(src) -- station id they clocked in at
exports['kartik-firefighterjob']:GetOnDutyFirefighters() -- list of server ids
exports['kartik-firefighterjob']:IsPlayerGeared(src) -- in turnout gear
exports['kartik-firefighterjob']:GetTeam(src) -- their team, or nil
exports['kartik-firefighterjob']:HasCertification(src, 'extrication')
exports['kartik-firefighterjob']:GetShiftSeconds(citizenid, days) -- seconds on duty in the last `days`
exports['kartik-firefighterjob']:GetStats(src) -- xp, missions, fires, rescues, saves, deaths
exports['kartik-firefighterjob']:AddXp(src, amount)
exports['kartik-firefighterjob']:IsOnNpcMission(src) -- working an NPC call right nowAlarms & dispatch
-- ring the closest crewed station (pages everyone on duty when no station is crewed)
exports['kartik-firefighterjob']:DispatchIncident({
coords = vec3(0.0, 0.0, 0.0),
callType = 'fire', -- Config.CallTypes
title = 'Structure Fire',
street = 'Forum Drive',
})
exports['kartik-firefighterjob']:RingStation(stationId, data, force) -- ring one station (force = even if nobody is clocked in there)
exports['kartik-firefighterjob']:StopAlarm(stationId)
exports['kartik-firefighterjob']:GetClosestStation(coords)
exports['kartik-firefighterjob']:TriggerPullStation(coords, 'Building') -- start a pull station alarm callFires
-- fireType: structure, vehicle, wildfire, dumpster, fuel, electrical, industrial, rescue, backburn, smoke
local id = exports['kartik-firefighterjob']:CreateIncident('structure', coords, {
label = 'Warehouse fire', street = 'Elysian Island', indoor = false, silent = false,
})
exports['kartik-firefighterjob']:RemoveIncident(id)
exports['kartik-firefighterjob']:GetIncidents()NPC calls
-- typeId: a key of Config.MissionTypes
local id = exports['kartik-firefighterjob']:StartMission('house_fire', {
label = 'Forum Drive', coords = vec3(-14.3, -1441.2, 31.1), heading = 0.0,
target = nil, -- cat / jumper spot
water = nil, -- true for water calls
})
exports['kartik-firefighterjob']:EndMission(id, 'completed') -- 'completed' | 'failed' (half score) | 'aborted' (no pay)
exports['kartik-firefighterjob']:GetMissions()Water & equipment
exports['kartik-firefighterjob']:GetWaterLevel(vehicle) -- litres
exports['kartik-firefighterjob']:SetWaterLevel(vehicle, litres)
exports['kartik-firefighterjob']:GetFoamLevel(vehicle)
exports['kartik-firefighterjob']:GetPlacedEquipment() -- cones, ladders, fans, pumps...
exports['kartik-firefighterjob']:GetReadiness() -- stations with their apparatus and equipmentDocuments
exports['kartik-firefighterjob']:GetSharedDocuments('police') -- documents shared with that job: { id, title, folder, author_name, updated_at }Client
exports['kartik-firefighterjob']:IsPlayerGeared()
exports['kartik-firefighterjob']:OpenGearMenu()
exports['kartik-firefighterjob']:GearDown()
exports['kartik-firefighterjob']:GetAirLevel() -- SCBA air left
exports['kartik-firefighterjob']:GetTruckWater(vehicle)
exports['kartik-firefighterjob']:openTablet()
exports['kartik-firefighterjob']:OpenTabletPage('calls') -- see The Fire Tablet for the page names
exports['kartik-firefighterjob']:useItem(itemName) -- used by the ox_inventory items
exports['kartik-firefighterjob']:useTablet() -- used by the fire_tablet item
exports['kartik-firefighterjob']:OpenSharedDocuments() -- the /firedocs viewer (firefighters get the Documents page)TriggerEvent('kartik-firefighterjob:client:openTabletPage', page) does the same as OpenTabletPage.
Server events
Listen with AddEventHandler:
| Event | Arguments |
|---|---|
kartik-firefighterjob:dutyChanged | src, onDuty, stationId |
kartik-firefighterjob:fleetSpawned | vehicle, src, stationId |
kartik-firefighterjob:alarm | stationId, alarm |
kartik-firefighterjob:incidentCreated | id, fireType, origin |
kartik-firefighterjob:incidentCompleted | id, fireType, contributors |
kartik-firefighterjob:incidentRemoved | id, completed |
kartik-firefighterjob:incidentHotspots | id (hot spots left behind) |
kartik-firefighterjob:incidentRekindled | id |
kartik-firefighterjob:incidentOverhauled | id |
kartik-firefighterjob:vehicleCaught | incidentId, newIncidentId, coords (fire spread to a parked car) |
kartik-firefighterjob:patientFreed | incidentId, src |
kartik-firefighterjob:rescueStep | incidentId, step, src (battery, roof, ...) |
kartik-firefighterjob:rescueSpark | incidentId (cutting a live car sparked a fire) |
kartik-firefighterjob:missionStarted | id, type, coords |
kartik-firefighterjob:missionEnded | id, result, score, participants |
kartik-firefighterjob:missionEscalated | id, level, auto |
kartik-firefighterjob:mayday | src, coords, auto |
kartik-firefighterjob:incidentRequest | missionId, kind, src, mdtCallId |
kartik-firefighterjob:patientHandover | medicSrc, sheet |
kartik-firefighterjob:arsonEvidence | missionId, investigation, origin |
kartik-firefighterjob:worldArson | incidentId, src, method, coords (a player set a fire: lighter or molotov) |
kartik-firefighterjob:inspectionFiled | src, siteId, result, findings |
kartik-firefighterjob:databaseReady | none |
Client events
| Event | Arguments |
|---|---|
kartik-firefighterjob:client:gearChanged | geared |
kartik-firefighterjob:client:alarmStarted | alarm |
For London Studios compatibility, firejob:cl:dutyChanged and firejob:client:GearStateChanged are fired too.
Example
-- pay a bonus for every fire put out
AddEventHandler('kartik-firefighterjob:incidentCompleted', function(id, fireType, contributors)
for src in pairs(contributors) do
print(('%s helped put out incident %s (%s)'):format(GetPlayerName(src), id, fireType))
end
end)