> For the complete documentation index, see [llms.txt](https://fivem.lvsoft.com.ar/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fivem.lvsoft.com.ar/qb-esx/lvs-gizmo.md).

# lvs-gizmo

### Gizmo

`exports.lvs_gizmo:useGizmo()` opens an interactive gizmo UI for editing an entity's position and rotation.

#### Parameters

* `entityData` (table|string|number):
  * If string/number: treated as entity handle
  * If table: should contain at least `handle` (entity handle), optionally:
    * `label` (string): display name for the entity (defaults to 'Unknown')
    * `hash` (number): model hash (defaults to GetEntityModel(handle))
    * `model` (string): model name (defaults to 'Unknown')
    * `image` (any): optional image data for UI

#### Returns

* `boolean|table`:
  * `false` if gizmo cannot be opened (NUI already focused) or entity is invalid
  * On success, returns a table with:
    * `placed` (boolean): true if edit was confirmed and object placed, false if cancelled
    * `position` (vector3): final position coordinates (only when placed=true)
    * `rotation` (vector3): final rotation coordinates (only when placed=true)
    * `initialCords` (table): contains initial position and rotation: -> `position` (vector3): initial position before edit -> `rotation` (vector3): initial rotation before edit

#### Usage Example

```lua
local model = 'prop_mp_cone_02'
local obj = CreateObject(model, pos.x, pos.y, pos.z, false, false, false)
local result = exports.lvs_gizmo:useGizmo({
    handle = obj,
    label = 'Cone',
    hash = GetEntityModel(obj),
    model = model,
})

if result then
    if result.placed then
        print("Object placed at:", result.position)
        print("Initial position was:", result.initialCords.position)
    else
        print("Edit cancelled")
    end
end
```

#### Behavior

1. Prevents multiple simultaneous gizmo sessions (returns false if NUI already focused)
2. Validates entity existence before proceeding
3. Captures initial entity state (position, rotation)
4. Opens NUI gizmo interface for interactive editing
5. Blocks most player controls during gizmo operation (except camera when right-click held)
6. Synchronizes game camera with UI during operation
7. On completion:
   * If confirmed ("placed"): returns updated position/rotation plus initial values
   * If cancelled: returns false for placed flag but still provides initial values for restoration
   * Always clears NUI focus and resets gizmo entity reference
