Skip to content

Exports and events ​

All calls listed here are server exports. Treat any source that can call them as trusted server code.

lua
exports.np_crime:CanStart(src, crimeType)                    -- advisory gate: boolean, reason, extra
exports.np_crime:StartCrime(src, crimeType, opts)             -- requires validated=true and scenarioId
exports.np_crime:ClaimLoot(src)                               -- retry undelivered rewards
exports.np_crime:GetHeat(srcOrIdentifier)                     -- integer 0..100
exports.np_crime:AddHeat(srcOrIdentifier, delta, reason)
exports.np_crime:RemoveHeat(srcOrIdentifier, delta, reason)
exports.np_crime:GetCrimeTypes()
exports.np_crime:GetCapabilities()
exports.np_crime:GetRun(runId)
exports.np_crime:Dispatch(src, crimeType, data)
exports.np_crime:ReportIncident(type, { src, identifier, heat, dispatch })
exports.np_crime:SellAtFence(src, itemName, count)
exports.np_crime:GetFenceReputation(srcOrIdentifier)
exports.np_crime:GetCrew(srcOrIdentifier)
exports.np_crime:CreateCrew(src, name)
exports.np_crime:InviteToCrew(src, targetServerId)
exports.np_crime:AcceptCrewInvite(src)
exports.np_crime:LeaveCrew(src)
exports.np_crime:RegisterHook('beforeStart', fn)
exports.np_crime:RegisterCrimeType(id, definition)             -- addon-owned, removed on owner stop
exports.np_crime:MarkVehicleStolen(vehicleOrPlate, stolen)    -- delegates to np_vehiclekeys

StartCrime requires the caller to have validated the real scenario server-side. validated is a declaration by trusted resource code, not a token; do not create a client event that accepts it or scenarioId from the player.

lua
-- Call after the addon has verified the active server-side target and interaction.
local ok, result = exports.np_crime:StartCrime(src, 'courier_hit', {
  validated = true,
  scenarioId = scenario.id,
  source = GetCurrentResourceName(),
})

For unrelated resource incidents, report from server code:

lua
exports.np_crime:ReportIncident('chop_shop', { src = src, heat = 8, dispatch = true })

Server events include np_crime:server:ready, np_crime:runStarted, np_crime:runFinished, np_crime:heatChanged, np_crime:externalIncident, np_crime:fenceSale, and np_crime:crewChanged. Client events are presentation-only and cannot set success, loot, heat or payout.