# Storage

> Reference for Storage in sky_jobs_base.

[All client exports](/docs/base/jobs-base/client-exports)

## Storage

### `getNearbyTrunkPropTarget(maxDistance)`

- **Purpose**: Finds the nearest managed trunk prop within the given distance.
- **Arguments**:

  - `maxDistance` (`number`) — search radius in game units.
- **Returns**: `table | nil`
  - `distance` (`number`) — distance to the prop.
  - `label` (`string`) — display label.

```lua
local target = exports["sky_jobs_base"]:getNearbyTrunkPropTarget(5.0)

if target then
    print(target.label, target.distance)
end
```

### `removeNearbyTrunkProp(maxDistance)`

- **Purpose**: Removes the nearest managed trunk prop.
- **Arguments**:

  - `maxDistance` (`number`) — search radius.
- **Returns**:

  - `boolean` — `true` on success.
  - `string?` — on failure, a locale key describing the error.

```lua
local success, errorKey = exports["sky_jobs_base"]:removeNearbyTrunkProp(5.0)

if not success then
    print("Failed:", errorKey)
end
```

### `startTrunkPropPlacement(prop, options)`

- **Purpose**: Starts the shared preview / place / cancel flow for a prop definition supplied by the calling client resource.
- **Arguments**:

  - `prop` (`table`) - prop definition with `model` (or `name` as its fallback), optional `label`, and optional preview settings.
  - `options` (`table?`) - optional placement settings:
  
    - `placementToken` (`string?`) - token issued by the built-in registered PropItems item flow.
    - `placeCallback` (`string?`) - `Sky.Cb` server callback invoked after the shared prop is registered.
    - `placeContext` (`table?`) - payload passed to `placeCallback`; Jobs Base adds the new `propId` before invoking it.
    - `amount` (`number?`) - finite number of placements the client may confirm; defaults to `1`.
    - `unlimited` (`boolean?`) - keep placement mode open until the player cancels it.
    - `stopAfterPlace` (`boolean?`) - when `true`, placement mode closes after one successful placement.
    - `radialInteraction` (`boolean?`) - mark the preview for radial-only confirmation/removal flows.
- **Returns**: `boolean` - `true` when placement mode started.

<code-group>

```lua [server.lua]
Sky.Cb.Register("my_resource:confirmRepairCratePlacement", function(source, context)
    if not canUseRepairCrate(source, context) or not consumeRepairCrate(source) then
        return { success = false }
    end

    return { success = true }
end)
```

```lua [client.lua]
RegisterNetEvent("my_resource:placeRepairCrate", function(crateId)
    exports["sky_jobs_base"]:startTrunkPropPlacement({
        name = "repair_crate",
        label = "Repair Crate",
        model = "prop_box_wood02a_pu",
        streamDistance = 150.0,
        removeDistance = 3.0
    }, {
        placeCallback = "my_resource:confirmRepairCratePlacement",
        placeContext = { crateId = crateId },
        stopAfterPlace = true
    })
end)
```

</code-group>

<callout color="info" icon="i-lucide-info">

When `placeCallback` is set, it must return `true` or `{ success = true }`. A rejected or invalid response removes the newly registered prop and ends placement. Canceling the preview does not invoke the callback.

</callout>
