Configuration

Config.lua Documentation

This document explains all configuration options available in config.lua and how they are used throughout the nn_storage system.


Creator Configuration

Config.Creator

Controls access to the storage creation command and UI.

Config.Creator = {
    Command = "cstorage",
    Job = "realestate",
}

Command (string)

  • Default: "cstorage"

  • Usage: Defines the chat command players use to open the storage creator UI

  • Description: Players type /cstorage (or whatever you set) to open the creator interface

Job (string)

  • Default: "realestate"

  • Usage: Restricts creator access to specific job

  • Description: Only players with this job can create storage units. Set to "nil" to allow all players

  • Special: If set to "nil" (string), bypasses job requirement


Player Configuration

Config.MaxPlayerWeight

Sets the maximum carrying capacity for players in the inventory system.

Config.MaxPlayerWeight = 100
  • Type: number (kilograms)

  • Default: 100

  • Usage: Used when sending player inventory data to UI

  • Description: Maximum weight a player can carry in their inventory (displayed in kg)

Config.GetItemImage

Function that generates image URLs for inventory items.

Config.GetItemImage = function(itemName)
    return "https://cfx-nui-qb-inventory/web/images/" .. itemName .. ".png"
end
  • Type: function

  • Parameter: itemName (string) - The item's name/identifier

  • Returns: string - Complete URL to the item's image

  • Usage: Called when building inventory data for UI display

  • Customization: Modify the base URL to point to your inventory system's image directory


Storage Configuration

Config.Storage

Main storage system configuration containing all storage-related settings.

SafeProps (table)

List of prop models that can be used for safe storage units.

SafeProps = {
    "p_v_43_safe_s",
    "prop_ld_int_safe_01",
    "v_ilev_gangsafe",
    "prop_cash_crate_01",
    "prop_security_case_01",
    "prop_ld_case_01"
}
  • Type: table (array of strings)

  • Usage: Provides options in the creator UI for safe prop selection

  • Description: GTA V prop models that can be used as visual representations for safes

SageOffsets (table)

Position offsets for different storage props to align interaction points properly.

SageOffsets = {
    ["p_v_43_safe_s"] = vector3(0.0, -0.5, 0.6),
    ["tr_prop_tr_container_01a"] = vector3(0.0, -2.0, 1.3),
}
  • Type: table (prop_name -> vector3)

  • Usage: Adjusts interaction point positioning relative to prop center

  • Description: Fine-tunes where players interact with storage props for better UX

ContainerProps (table)

Defines the default prop model used for container storage units.

ContainerProps = {
    default = "tr_prop_tr_container_01a"
}
  • Type: table

  • Usage: Auto-assigned when creating container storage

  • Description: Container storage always uses this prop model (shipping container)

Pricing (table)

Cost structure for different storage types based on capacity and features.

Pricing = {
    safe = {
        base = 5000,
        capacityPrice = 20, -- per kg
        keyPrice = 250 -- per key
    },
    locker = {
        base = 2500,
        capacityPrice = 15,
        keyPrice = 250
    },
    container = {
        base = 10000,
        capacityPrice = 10,
        keyPrice = 250
    }
}
  • Type: table (storage_type -> pricing_config)

  • Usage: Calculates total cost during storage creation

  • Components:

    • base: Fixed base cost for the storage type

    • capacityPrice: Cost per kilogram of storage capacity

    • keyPrice: Cost per physical key generated

WeightLimits (table)

Minimum and maximum weight capacities for each storage type.

WeightLimits = {
    safe = { min = 50, max = 500 },
    locker = { min = 25, max = 200 },
    container = { min = 500, max = 2000 }
}
  • Type: table (storage_type -> {min, max})

  • Usage: Enforces capacity limits in creator UI

  • Description: Sets the allowable weight range for each storage type (in kg)

Placement (table)

Visual and interaction settings for the storage placement system.

Placement = {
    markerType = 1, -- Arrow pointing down
    markerColor = { r = 31, g = 238, b = 176, a = 200 }, -- Green color
    markerSize = { x = 1.0, y = 1.0, z = 1.0 },
    interactionDistance = 3.0,
    placementDistance = 50.0 -- Max distance for placement
}
  • Type: table

  • Usage: Controls visual feedback during storage placement

  • Components:

    • markerType: GTA V marker type ID (1 = downward arrow)

    • markerColor: RGBA color values for the placement marker

    • markerSize: X, Y, Z scale of the placement marker

    • interactionDistance: How close players must be to interact (in meters)

    • placementDistance: Maximum distance from player for placing storage


Item Rarity Configuration

Config.Rarity

Defines rarity levels for items, affecting their visual appearance in the inventory UI.

Config.Rarity = {
    ['laptop'] = 'epic',
    ['lockpick'] = 'uncommon',
    ['bandage'] = 'common',
    ['mw_ladder'] = 'common',
    ['weapon_pistol'] = 'rare',
    ['moneybag'] = 'legendary',
    ['phone'] = 'uncommon',
    ['radio'] = 'uncommon',
    ['goldbar'] = 'legendary',
    ['washer_large'] = "epic",
    ['storage_key'] = 'rare'
}
  • Type: table (item_name -> rarity_level)

  • Usage: Applied when building item data for UI display

  • Rarity Levels: "common", "uncommon", "rare", "epic", "legendary"

  • Default: Items not listed default to "common"

  • UI Effect: Different rarity levels display with different colors/styling in the inventory


Storage Key Configuration

Config.StorageKey

Defines the item properties for physical storage keys when using key-based access.

Config.StorageKey = {
    item_name = "storage_key",
    label = "Storage Key",
    description = "A key that provides access to secured storage",
    weight = 0.1,
    image = "storage_key.png",
    stackable = false
}
  • Type: table

  • Usage: Referenced when creating physical key items for storage access

  • Components:

    • item_name: Database identifier for the key item

    • label: Display name shown in inventory

    • description: Tooltip text for the item

    • weight: Item weight in kilograms (0.1kg)

    • image: Filename for the key's inventory icon

    • stackable: Whether multiple keys can stack (false for unique keys)


Configuration Usage Patterns

Price Calculation

The system uses a three-component pricing model:

  1. Base Price: Fixed cost per storage type

  2. Capacity Price: Variable cost based on weight capacity

  3. Key Price: Additional cost for each physical key

Weight Management

  • Server stores weights in grams internally

  • UI displays weights in kilograms

  • Conversion happens during data transfer (weight / 1000)

Access Control Priority

  1. Job Access: Automatic access if player job matches storage job

  2. Key Access: Requires physical key item in inventory

  3. PIN Access: Requires correct PIN code entry

  4. Public Access: No authentication required

Storage Type Differences

  • Safes: Optional props, medium capacity, higher cost per kg

  • Lockers: Multiple units per storage, no props, lowest cost per kg

  • Containers: Always use props, highest capacity, lowest cost per kg


Customization Examples

Change Storage Capacity Limits

Config.Storage.WeightLimits = {
    safe = { min = 100, max = 1000 },     -- Increase safe capacity
    locker = { min = 50, max = 300 },     -- Increase locker capacity
    container = { min = 1000, max = 5000 } -- Increase container capacity
}

Adjust Pricing

Config.Storage.Pricing = {
    safe = {
        base = 10000,        -- Double base price
        capacityPrice = 30,  -- Increase per-kg cost
        keyPrice = 500      -- Double key cost
    }
}

Change Creator Access

Config.Creator = {
    Command = "createstorage",  -- New command
    Job = "nil",               -- Allow all players
}

Custom Item Images

Config.GetItemImage = function(itemName)
    -- Use different inventory system
    return "nui://ox_inventory/web/images/" .. itemName .. ".png"
end

Last updated