mri-fivem-skills
All skills

mri-world-placement

World placement

World placement standard for FiveM resource creation panels.

A creation panel configures, it doesn't program. Position, heading, size and path are marked in the world, with a preview; never a number field, a coordinate or a typed name.

Tools

Tool For Module
Point with ghost NPC, object, interaction point: a see-through copy follows the aim WorldPlacer.point
Path NPC route, trail, fence: stops with a line on the ground WorldPlacer.path
Zone (box with heading) anything shaped like a cube that faces a way: elevator floor, garage spot, shop counter, stash, trigger area WorldPlacer.zone

Pick by shape: a model to stand somewhere is a point; a sequence is a path; a volume with a front is a zone. The zone sits on the player (walk to it, the player's heading turns it), with a yellow box, an arrow for the heading and the size written above; zones already placed show in green with their label (refs). multiple marks several in a row (floors of an elevator). Pattern from mri_Qelevators (client/placement.lua).

Keys (the same in every resource)

Key Point Path Zone
Aim / walk moves the ghost previews the next stop the box follows the player
E confirm mark stop mark (single: confirm)
← →, wheel rotate wheel: width; Shift + wheel: height
Backspace cancel undo the last one undo the last one (single: cancel)
Enter finish (no stop = cancel) finish (no zone = cancel)
Esc cancel cancel cancel

mri_Qelevators itself still finishes on Backspace (it predates this standard). Cancelling always gives back what was there before. Sound: SELECT on mark, BACK on undo or cancel (HUD_FRONTEND_DEFAULT_SOUNDSET).

Wiring into a resource

  1. templates/placement.lua into client/ (rename the global). Before the files that use it in fxmanifest.lua; a new file in the manifest needs refresh before ensure.
  2. templates/panel.lua: place, recordRoute and placeZone callbacks with inWorld (hides the panel, runs the tool, comes back with the result; inside mri_Qadmin it closes and reopens the tab).
  3. NUI: templates/PlaceRail.tsx and the keys from templates/rail.locales.json. A store with hud fed by the placeHud message (false clears it). The rail shows with the panel hidden, on the resource's own ui_page; inside the Qadmin iframe it doesn't render (the iframe is hidden).
  4. On the panel the result becomes a summary, not numbers: "3 stops · 29 m · there and back", "Position marked". A "Mark again" button starts over.

Frame rules (no flicker, no missed keys)

What the system decides by itself

NPC walking the route

Reference: mri_Qnpc (client/route.lua).

Verify