np_logistics API ​
All exports are server-side. Calls from another resource are trusted resource calls; player actions use the NUI RPC path and are independently feature, ownership, range, and rate checked. The current host API level is 1 (npAddon.host({ api = 1 })). Registrations from sibling resources should occur in npAddon.attach('np_logistics', fn, { api = 1 }).
Supply orders ​
order(spec) -> orderId | nil, err:spec = { sink, from, to, kind?, cargo?, payer?, budget?, deadline?, npcFallback?, legs?, meta? }. The calling resource must own a registered sink. Budget is server validated and bounded.- Compatibility overload
order(venueId, lines) -> orderId | nil, erris provided for the current np_commerce implementation. It posts an unfundednp_commercesink order; new callers should use structuredorder(spec)with an explicit payer and budget. createCourierLeg(spec) -> orderId | false, err: compatibility export consumed by current np_commerce. Accepts an order-shaped table withfrom,to/stash,cargo/items,payer,budget/reward, and optionalorderwrapper.cancelOrder(orderId, reason) -> boolgetOrder(orderId) -> order | nilgetOrders(filter?) -> order[]
Register a sink with registerSink(id, { deliver, cancelled?, partial? }). deliver(order, contract) runs only when the final leg completes. Sinks are owner tracked and removed on resource stop.
Contracts and legs ​
postContract(src, spec) -> contractId | nil, errgetContracts(filter?) -> contract[]getContract(id) -> contract | nilacceptLeg(src, contractId, legSeq) -> bool, reason?abandonLeg(src, contractId, legSeq) -> bool, reason?completeLeg(src, contractId, legSeq, result) -> bool, reason?
Payouts and refunds use durable logistics_payouts rows with a unique payout reference. Funded player contracts transfer from the dedicated personal escrow holding account to the recipient's personal account. Without np_banking, posting debits framework bank money and online settlement credits the framework bank; offline payouts remain pending and retry when the player logs in. A framework credit interrupted after entering processing is uncertain and requires manual reconciliation rather than an automatic duplicate payment.
Units, places, and reputation ​
createUnit(type, spec) -> unitId | nil, errgetUnit(id) -> unit | nilgetUnitStash(id) -> stashId | nilgetUnitsAt(placeId) -> unit[]sealUnit(id, sealId?) -> bool, reason?breakSeal(id, src) -> bool, reason?registerPlace(def) -> bool, reason?;unregisterPlace(id) -> boolregisterBin(placeId, def) -> binId | false, reason?scheduleShip(def) -> shipId | nil, err;getShipSchedule() -> ship[]getRep(cid) -> record;addRep(cid, delta, reason) -> repinspectCargo(src, stationId, unitIds, declaredKg, result) -> bool, record | reasonspawnVehicle(model, coords, heading, kind?, metadata?) -> entity, vehicleId | nil, errhitchTrailer(src, truckEntity, trailerEntity) -> bool, reason?unhitchTrailer(src, truckEntity, trailerEntity) -> bool, reason?
A place definition is { id, type, label, coords = { x, y, z }, ownerFaction?, sink?, meta? }. Bins are { code, capacityKg }.
Extension registrations ​
registerSink(id, def)registerCargoType(id, def)registerNpcFreightSource(id, generatorFn)registerDockRig(id, def)registerInspectionCheck(id, checkFn)addHook(name, fn); supported veto points includebeforeAccept,beforeHitch,beforeSeal,beforeBreakSeal,beforeHijack,beforeDeliver, andbeforeNpcFallback.registerMailboxProvider(id, { deliverToMailbox, dropAtDoor })registerPremises(faction, premises)/releasePremises(faction, premises)for np_housing venue callbacks.deliverToMailbox(propertyId, item, meta)/dropAtDoor(propertyId, item, meta)forward to a registered mailbox provider.
Server events use TriggerEvent and are not network events: np_logistics:orderCreated, contractPosted, legAccepted, legCompleted, contractDelivered, contractFailed, unitSealBroken, cargoStolen, inspection, shipArrived, and shipLeft.
Exports present in source ​
order, createCourierLeg, cancelOrder, getOrder, getOrders, postContract, getContracts, getContract, acceptLeg, abandonLeg, completeLeg, createUnit, getUnit, getUnitStash, getUnitsAt, sealUnit, breakSeal, registerPlace, unregisterPlace, registerBin, scheduleShip, getRep, addRep, registerSink, registerCargoType, registerNpcFreightSource, registerDockRig, registerInspectionCheck, addHook, registerMailboxProvider, registerPremises, releasePremises, deliverToMailbox, dropAtDoor, inspectCargo, getShipSchedule, spawnVehicle, hitchTrailer, unhitchTrailer.
Implementation notes above reflect the checked-in adapters. Live FiveM verification remains outstanding.