Skip to main content

zydrec-robbery-lib

Installation

Keep the resource folder name as:
zydrec-robbery-lib
Renaming the resource is not supported and may break exports, events, or external integrations.

Configuration

Configuration is located in:
config/zydrec-gemsjewelry.lua
Available settings:
ServerConfig.Enabled
ServerConfig.SmashDistance
ServerConfig.Debug
ServerConfig.AllowedWeapons
ServerConfig.Locations
When ServerConfig.Enabled = false, the module does not register exports, events, or cabinet state. Set:
ServerConfig.AllowedWeapons = false
to disable weapon validation entirely.

Usage

Example smash flow:
local cabinetId = exports['zydrec-robbery-lib']:getNearestCabinetId(source)
if not cabinetId then return end

if not exports['zydrec-robbery-lib']:canSmashCabinet(source, cabinetId) then
    return
end

local success = exports['zydrec-robbery-lib']:smashCabinet(source, cabinetId, true)
if not success then
    return
end

Exports

getNearestCabinetId(source)
getNearestCabinetIdFromCoords(coords, maxDistance)

isCabinetSmashed(cabinetId)

canSmashCabinet(source, cabinetId)

smashCabinet(source, cabinetId, playAnimation)
smashNearestCabinet(source, playAnimation)

resetCabinet(cabinetId)
resetCabinetsInLocation(locationRef)
resetAllCabinets()

getNearestCabinetId

Returns the nearest cabinet within 10.0 units. Returns:
cabinetId | nil

getNearestCabinetIdFromCoords

Accepts:
  • vector3
  • vector4
  • Table containing x, y, and z
maxDistance defaults to 10.0. Returns:
cabinetId | nil

canSmashCabinet

Returns true when the player can smash the specified cabinet. Checks:
  • Valid player ped
  • Valid cabinet
  • Cabinet is intact
  • Distance validation
  • Weapon validation (if enabled)

smashCabinet

Returns:
true | false
When playAnimation is enabled, the server waits for the client animation flow to complete before returning a result.

smashNearestCabinet

Returns:
cabinetId | nil

resetCabinetsInLocation

Accepts either a configured location name or location index. Examples:
resetCabinetsInLocation('Paleto')
resetCabinetsInLocation(3)
resetCabinetsInLocation('3')

Debug

Enable debug rendering with:
ServerConfig.Debug = true
When enabled, cabinet labels and prop outlines are rendered for development and testing.