np_prophandler
The one place the np_* resources get their props from. A resource describes a prop once. The handler decides whether a player should see it, spawns and deletes it, hides it at range, loads and releases its model and cleans up when the owning resource stops. Map objects and doors too.
- Version
- 1.1.0
- Status
- Specs pass against stubbed natives, not yet run on a live server
- Frameworks
- Standalone. ESX first, then qbx or qb, for job and gang conditions
- Dependencies
- None
- Interaction
- np_hud prompt, ox_target or qb-target, all optional
- Admin
- np_admin optional, no ACE
- Budgets
- 256 streamed props per client and 64 networked props by default
- UI
- None, no NUI to build
Where the player stands
- Close: spawned and shown. Spawns go nearest-first, four per pass.
- Past an optional renderDistance: hidden, not deleted. It only hides 3 m past the line.
- Just past spawnDistance: kept for another 10 m, so standing on the edge doesn't spawn and delete it over and over.
- Further out: hidden at once and deleted after 10 s. At the cap, hidden props go first.
exports.np_prophandler:registerProp({
id = 'np_manufacturing:laptop_1',
model = 'prop_laptop_01a',
coords = vector4(-337.2, -136.5, 39.0, 70.0),
collision = false,
spawnDistance = 40.0,
interact = { label = 'Open', icon = 'laptop', event = 'np_manufacturing:openWorkshop' },
data = { workshop = 1 },
})np_prophandler has no UI. The diagram shows the defaults for a streamed prop in shared/config.lua, not to scale. Networked props use a 15 m margin and 15 s.
What's in it
Register once, and the handler owns availability, spawn and despawn, render and derender. One streaming loop and one set of limits instead of the distance checks every resource ran on its own.
Streamed props
- A local object on each client near it: vending machines, lab equipment, workshop laptops, drops.
- Registered on the server for everyone, or with
addLocalPropfor one player.
Render tier
- Out of range a prop is hidden at once and deleted after 10 s, so walking back and forth doesn't churn entities.
renderDistancehides a prop that is still in range without deleting it.
Networked props
- One OneSync object the server creates only while a player in its routing bucket is near.
- Deleted 15 s after the last one left, recreated if something else deletes it.
- With
dynamic = trueit stays where it was pushed or dragged, and comes back there.
Attached props
- A phone in hand, a carried box, an ID card. Synced through the player's state bag.
- Every client draws its own local copy on that ped. No networked objects.
Props you create now
- Placement ghosts and previews with
createLocal, returned at once when the model is loaded. - Otherwise the model loads in the background and a callback gets the entity.
- They can carry interact options too, e.g. Place and Cancel on a ghost.
Map objects
- Hide a map bench or swap a sign, by model in a radius.
- Applied while players are near, removed when they leave.
keepScriptObjectshides only the map's copies, so handler props of the same model stay.
Doors
- Single doors, double doors and gates of up to 8 parts as one door, the lock state on the server.
- An optional prompt for the right jobs or gangs, hidden per player by a client predicate; the server re-checks bucket, distance and job before it toggles.
Availability and interact
enabled, routing bucket, jobs or gangs with a minimum grade, in-game hours.- Up to six interact options per prop, each with its own key, event and conditions: the np_hud prompt, then ox_target, then qb-target.
- Client predicates hide an option while the player can't use it.
Budgets and diagnostics
- One ref-counted model loader with a timeout; missing models are never requested again.
np_prophandler:readyon server and client tells resources to register again after a restart.prophandler_debuggated through np_admin, live settings, no ACE.
A closer look
Six kinds of props
Everything belongs to the resource that registered it. Only that resource can change or remove it, and it goes when that resource stops.
| Kind | Where it lives | Use it for |
|---|---|---|
| Streamed | A local object on each client near it | Vending machines, lab equipment, workshop laptops, drops |
| Networked | One OneSync object, created by the server near players | Crates and carried-off objects whose physics or position others must share |
| Attached | A local copy on every client that can see the ped | A phone in hand, a carried box, an ID card |
| Immediate | A local object, created now | Placement ghosts, previews |
| World models | The map itself | Hiding a map bench, swapping a sign |
| Doors | The game's door system | Lockable doors, double doors and gates |
- Sync: a client gets one snapshot when it starts, then small state messages with consecutive revisions. A client that misses one asks for a new snapshot.
- Grid: a pass looks only at nearby cells and is skipped while the player stands still and nothing changed.
- Batches:
registerProps,removePropsandremoveAllPropssend one state message. - Conditions decide what is shown. They are not security.
Carried props
The local copy is created right away. With synced = true the server writes it into the player's state bag and every other client draws its own copy on that ped.
-- client: a phone in hand that others see
local handle = exports.np_prophandler:attach({
model = 'prop_npc_phone_02', bone = 28422,
offset = vector3(0.0, 0.0, 0.0), rotation = vector3(0.0, 0.0, 0.0),
synced = true, key = 'phone',
})
exports.np_prophandler:detach(handle)
-- server: a mission crate
exports.np_prophandler:setPlayerAttachments(source, 'crate', {
{ model = 'prop_cs_cardbox_01', bone = 60309,
offset = vector3(0.025, 0.08, 0.255), rotation = vector3(-145.0, 290.0, 0.0) },
})
exports.np_prophandler:setPlayerAttachments(source, 'crate', nil) -- remove- Copies are drawn while the ped is in scope and within 150 m, and deleted when the player leaves scope or drops.
- Rebuilt when the ped is re-created, after a model change or a respawn.
- Only the server writes the bag. Client requests are validated and rate-limited, up to 8 entries per player.
Doors and map objects
Both are registered on the server and applied on clients while they are near.
exports.np_prophandler:registerDoor({
id = 'np_police:front',
doors = { -- up to 8 parts, one door
{ model = 'v_ilev_ph_door01', coords = vector3(434.7, -980.6, 30.8) },
{ model = 'v_ilev_ph_door002', coords = vector3(434.7, -983.2, 30.8) },
},
locked = true, jobs = { police = 0 }, interact = true, distance = 2.0,
})
exports.np_prophandler:setDoorLocked('np_police:front', false) -- keys, lockpicks: your call
exports.np_prophandler:hideWorldModel({ id = 'np_billiards:map_table', coords = vector3(...),
radius = 2.0, model = 'prop_pooltable_02', keepScriptObjects = true })- Lock state lives on the server. Clients add the door to the door system within 50 m and remove it beyond.
- The prompt shows only to matching jobs or gangs, and a client predicate can hide it (no key). The server re-checks bucket, distance and job, with a cooldown, before it toggles.
setDoorLockedcan be called by any server resource. Authorization stays with the caller.- Map objects: hidden or swapped within their radius plus an apply distance, restored past a margin.
keepScriptObjectsleaves script objects of the model alone.
The definition
Unknown fields are rejected. Any model is accepted unless you set the optional allowedModels list.
| Field | Default |
|---|---|
| id, model, coords | Required. Ids up to 64 characters |
| rotation | From the heading |
| spawnDistance | 80, 5 to 300 |
| renderDistance | None, 1 to spawnDistance |
| despawnDelayMs | 10000 |
| routingBucket | All buckets, 0 for networked props |
| jobs, gangs | { police = 0 } or { 'police' }, either one matching |
| hours | { from = 22, to = 6 } |
| Field | Default |
|---|---|
| frozen, collision | true |
| placeOnGround | false, not for networked props |
| alpha, invisible | Opaque, drawn. invisible keeps collision |
| lodDistance, textureVariation | Game default, none |
| enabled | true |
| networked, dynamic | false, server registrations only |
| interact | { name, event, label, icon, key, distance, server, jobs, gangs, hours }, or a list of up to 6 |
| data | A small table passed to events |
The interact event must start with your resource name and a colon, unless it is listed in interaction.allowedEvents. Each option has its own key (E G H K X Y Z), and the event gets the option's name. A server event gets the net ID of a networked prop and 0 for everything else, and must validate the request itself.
Not verified in-game
Version 1.1.0 has never run on a live server. The specs pass against stubbed natives; nothing has been checked in game, not the natives, not the look, not the performance with real player counts.
- Server-side object creation, orphan mode, state bags on server objects and the recreate path.
- The door system calls; some door scripts set an extra state first.
- Model hide and swap parameters, texture variation and the hide call of the render tier.
- Attach flags on copies of other players' peds, and how fast scope changes show up.
- The ox_target and qb-target option shapes, the np_hud prompt with several keys, and server moves of dynamic props.
- Known limits: every client holds every definition (up to 4096) and filters locally, with no per-area interest management.
- The server can't check that a networked prop's model exists. At the cap, networked props are created in registry order, not nearest-first.
createLocalandattachdon't block, so an unloaded model means entity0at first.- Doors are locked or unlocked, nothing more, and door toggles don't check
hours.
Set it up
Compatibility
Nothing else is required. Everything below is detected at runtime and never required.
| Kind | Supported |
|---|---|
| Framework | es_extended first, then qbx_core, then qb-core, for job and gang conditions. Force one with framework |
| Interaction | np_hud prompt, ox_target or qb-target, an optional built-in E-key text |
| Staff | np_admin, or the console, np_admin_fallback identifiers and ESX groups. No ACE |
| NP DEV resource | What np_prophandler does with it |
|---|---|
| np_npchandler | The counterpart for peds; the np_* resources run both, and its held props come here |
| np_hud | The interact prompt |
| np_admin | The np_prophandler.debug node and live settings for budgets, limits and the fallback |
Installation
No database, no NUI build.
- Put the folder in your resources as
np_prophandler. - Start it before the resources that use it:
ensure np_prophandler - Optional: np_hud, ox_target or qb-target for interaction, np_admin for permissions and live settings.
- Budgets and limits are in
shared/config.lua, the most used ones also in np_admin. - Check the specs if you change it:
luac -pon every file, thenlua tests/*_spec.lua.
Used by the np_* resources
Every np_* resource with props lists np_prophandler as a required dependency, with no fallback. Start it before them.
| Resource | What goes through np_prophandler |
|---|---|
| np_banking | The configured ATM props, registerProps; the ripped-out ATM as a dynamic networked prop |
| np_billiards | Tables as registerProps, map balls hidden with keepScriptObjects, balls as local props, the cue in the hand |
| np_cctv | Camera and recorder props with up to six options each, addLocalProp, and the placement ghost |
| np_darts | Cabinets as registerProps, the thrown darts, the placement ghost, darts in the hand |
| np_drugs | Lab equipment, used syringes with an interact option, held items |
| np_environmental | Scene props, the editor ghosts and the tools in the hand |
| np_farming | Crops, hives, pens and threats as addLocalProp, tools and produce in the hand |
| np_fishing | Market stalls, the rod and float, shown-off and dropped fish |
| np_fuel | EV charger props with the charge prompt, the nozzle in the hand |
| np_gangs | The carried crate, attach with synced = true |
| np_golf | Balls and tee pegs as local props, the club in the hand |
| np_identification | The card in the hand, attach with synced = true |
| Resource | What goes through np_prophandler |
|---|---|
| np_inventory | Drops as registerProp with placeOnGround, held items as attachments |
| np_manufacturing | Workshop laptops as registerProps with the open prompt, attachment props on vehicles |
| np_metal-scanner | Scanner props, the placement ghost, the wand and ground detector in the hand |
| np_passwords | Lock doors (up to 8 parts as one door) through registerDoor and setDoorLocked, keypad props |
| np_phone | The phone in the hand, attach with synced = true |
| np_prison | Held props during progress bars, cell doors when no ox_doorlock or qb-doorlock runs |
| np_screens | Tripods as registerProp, the placement ghost, the live rig in the hand |
| np_shops | Props in the hand of the player and the clerk, like the fuel nozzle |
| np_spy-pigeon | Droppings, loft coop props and the spikes preview |
| np_surveillance | Placed bugs and devices, registerProp and updateProp |
| np_vending | Machines as registerProps, the placement ghost, the can in the hand |
Exports
Server exports for props, attachments, map objects and doors, client exports for local props, ghosts, lookups and predicates, plus lifecycle and ready events.
-- server: only some players see it
exports.np_prophandler:registerProp({
id = 'np_police:armory_crate', model = 'prop_box_ammo04a', coords = vector3(452.1, -980.0, 30.7),
jobs = { police = 2 }, hours = { from = 22, to = 6 }, routingBucket = 0,
})
-- client: a placement ghost
local handle, entity = exports.np_prophandler:createLocal({
model = 'prop_tv_flat_01', coords = surface, alpha = 180, collision = false,
}, function(handle, entity) end)
exports.np_prophandler:deleteLocal(handle)
-- hide an option while the player can't use it
exports.np_prophandler:setCanInteract('np_banking:atm_3', 'rob', function(entity, id, option, data)
return not LocalPlayer.state.cuffed
end)
-- lifecycle: register again after a restart of np_prophandler
AddEventHandler('np_prophandler:ready', registerAll)
AddEventHandler('np_prophandler:spawned', function(id, entity, data) end)| Side | Main exports |
|---|---|
| Server | registerProp(s), updateProp, removeProp(s), getPropCoords, setPropCoords, spawnProp, setPlayerAttachments, hideWorldModel, swapWorldModel, registerDoor, setDoorLocked, redeemInteraction, getDiagnostics |
| Client | addLocalProp, getPropEntity, isPropVisible, createLocal, attach, detach, setCanInteract, setDoorCanInteract, requestDoorToggle, getDiagnostics |
Questions
Has it run on a live server?
Not yet. Version 1.1.0 is covered by plain-Lua specs that load the real scripts against stubbed natives. Nothing has been checked in game: not the natives, not the look, not the performance with real player counts. Expect fixes in the first versions.
Is this something players see?
Only through the resources that use it. It has no UI. It is the place other scripts get their props from, so a laptop, a drop or a phone in hand is spawned, hidden and cleaned up the same way everywhere.
Can a prop have more than one option?
Yes. Since 1.1.0 interact takes a list of up to six options, each with its own key (E G H K X Y Z), label, event and jobs, gangs or hours. np_hud shows one key per option, ox_target and qb-target one target option each. A client predicate hides an option while the player can't use it.
Which np_* resources use it?
Every np_* resource with props, from np_phone and np_inventory to np_prison and np_vending, 23 in all. They list it as a required dependency and have no fallback of their own, so start it before them. The table under Set it up shows what each one sends through it.
Why are carried props not networked objects?
The attachment goes into the player's state bag and every client draws a local copy on that ped. Nothing is left behind as a stray networked object, and the server decides what goes into the bag.
Does it use ACE permissions?
No. prophandler_debug is gated by the np_admin node np_prophandler.debug. Without np_admin, the console, identifiers in np_admin_fallback and ESX groups in np_admin_fallback_groups.
Do I need a framework?
No. ESX, qbx or qb are only used for jobs and gangs conditions. Without one, those conditions never match and everything else works.
Works well with

Register a prop once. Let the handler do the rest.
Usage by pattern, the definition, exports, events and configuration are in the docs.