Skip to content

Exports ​

All exports are called as exports.np_manufacturing:<name>(...).

Server ​

server

Read exports can be called by any server resource. Privileged exports only accept calls from np_manufacturing itself, the server console, or a resource listed in trustedServerResources; anyone else gets false (or false, 'not_trusted').

Export Privileged Returns Description
getBuildForVehicle(vehicleKey) Build | nil The build currently applied to a vehicle (a copy of the stored build)
getVehicleInspection(modelHash) VehicleInspection | nil What the server has recorded about a model seen in a bay
getFleetVehicle(vehicleKey) FleetVehicle | nil Registry entry: model, plate, organization, unit, callsign, applied / queued build, last seen, wear
getBrandKit(organizationId) BrandKit | nil The organization's brand kit (nil when brand kits are off)
getBakedLivery(templateId, buildId) { system, index, bakedAt, bakedByName } | nil The native livery a baked live build uses (system = 'livery' or 'mod')
registerTemplate(template) yes boolean Store a vehicle template as pending. See Templates & catalog
registerAttachment(definition) yes boolean Store a part definition as pending
setTemplateStatus(templateId, status) yes boolean 'approved', 'pending', 'revoked' or 'rejected'
setAttachmentStatus(definitionId, status) yes boolean Same for parts
queueBuildForVehicle(vehicleKey, buildId, unit?) yes ok, reason? Queue an approved build for a registered vehicle; applied the next time it parks in a bay (right away if it's parked in one now)

Vehicle keys ​

Builds, fleet entries and wear are keyed by a vehicle key built from the model and the persistent id:

<model>:persistent:<id>     -- from the persistent id state bag (vehiclePersistentId, persistentVehicleId)
<model>:plate:<PLATE>       -- only with allowPlateIdentityFallback
<model>:net:<networkId>     -- only with allowEphemeralVehicleIdentity

For example police:persistent:veh_7c1e9a.

Examples ​

lua
-- garage: show the livery a car has
local build = exports.np_manufacturing:getBuildForVehicle(('police:persistent:%s'):format(persistentId))
if build then print(build.name, build.status, build.applicationMode) end

-- fleet manager: does this car need a repaint?
local entry = exports.np_manufacturing:getFleetVehicle(vehicleKey)
if entry and entry.wear and entry.wear.needsRepaint then
  -- …
end

-- a newly bought fleet car gets the organization's current design (trusted resource)
local ok, reason = exports.np_manufacturing:queueBuildForVehicle(vehicleKey, 'build_abc123', '042')
if not ok then print('queue failed:', reason) end

queueBuildForVehicle reasons: not_trusted, vehicle_unknown (not in the fleet registry), build_not_available (missing, not approved or revoked), incompatible (the build's template doesn't match the vehicle), or a storage error.

Client ​

client

Export Returns Description
openWorkshop(workshopId?) { ok, vehicle?, reason?, alreadyOpen? } Open the console for a workshop (default: the nearest one) and capture the bay vehicle. The server still runs every bay check
closeWorkshop() Close the console and release the session
captureVehicle(networkId?) { ok, vehicle?, pending?, reason? } Capture a vehicle (default: the one in the bay) and request a session for it. pending = true: the session request is in flight
lua
-- open the console from your own target / interaction system
exports.np_manufacturing:openWorkshop('mrpd_bay1')

Opening the console from code doesn't bypass anything: the session still needs the player at the workshop and a ready bay.

Commands ​

Command Available Description
np_manufacturing_release_focus always Close the console and release NUI focus (recovery after a restart). Alias: npv_vehiclemanufacturing_release_focus
np_manufacturing_open developmentCommands = true Open the console at the nearest workshop
np_manufacturing_close developmentCommands = true Close it
np_manufacturing_workshop_here <id> [computer|bay] always, np_manufacturing.admin Capture a workshop at your position and print a ready workshops entry (F8, server console, chat). Never writes files. Also in np_admin as the staff tool Workshop position here. See Going live

State bags ​

Bag (vehicle) Written by Description
vehiclePersistentId your garage, or np_manufacturing (autoAssignPersistentId) Persistent vehicle id (also read: persistentVehicleId)
vehicleOrganizationId your garage / spawner Owning organization
vehicleUnit your scripts Unit for {unit}
vehicleCallsign your scripts Callsign for {callsign}
vehicleBuildId np_manufacturing Applied build id. Clients re-request the build when it changes
vehicleLiveryWear np_manufacturing Wear 0..100, rendered as dirt

Net events ​

These are internal and listed for reference; don't trigger them from other resources.

Event Direction Payload
np_manufacturing:rpc client → server { id, name, payload }, see the NUI contract
np_manufacturing:rpc:reply server → client { id, ok, data?, reason?, params? }
np_manufacturing:push server → client { action, payload }, forwarded to the NUI
np_manufacturing:application:manifest server → all Apply a build's props, livery or texture to a networked vehicle
np_manufacturing:application:clear server → all Remove them
np_manufacturing:application:sync client → server { vehicles } every 30 s
np_manufacturing:application:texture server → client (latent) Runtime or per-car texture bytes (never for baked builds)
np_manufacturing:texture:request client → server { buildId, assetId, networkId }
np_manufacturing:job:step client → server { jobId, stepId, phase = 'start' | 'complete' }
np_manufacturing:photo:save client → server { url } → np_phone gallery
np_manufacturing:cleanup server → client The server closed the session
np_manufacturing:workshop:snippet server → client { ok, lines, snippet? }, answer to np_manufacturing_workshop_here