Browse docs
Storage
Reference for Storage in sky_jobs_base.
Storage
getNearbyTrunkPropTarget(maxDistance)
- Purpose: Finds the nearest managed trunk prop within the given distance.
- Arguments:
maxDistance(number) — search radius in game units.
- Returns:
table | nildistance(number) — distance to the prop.label(string) — display label.
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—trueon success.string?— on failure, a locale key describing the error.
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 withmodel(ornameas its fallback), optionallabel, and optional preview settings.options(table?) - optional placement settings:placementToken(string?) - token issued by the built-in registered PropItems item flow.placeCallback(string?) -Sky.Cbserver callback invoked after the shared prop is registered.placeContext(table?) - payload passed toplaceCallback; Jobs Base adds the newpropIdbefore invoking it.amount(number?) - finite number of placements the client may confirm; defaults to1.unlimited(boolean?) - keep placement mode open until the player cancels it.stopAfterPlace(boolean?) - whentrue, placement mode closes after one successful placement.radialInteraction(boolean?) - mark the preview for radial-only confirmation/removal flows.
- Returns:
boolean-truewhen placement mode started.
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)
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)
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.