Configuration

This showcases and explains the config.lua file within the Faction System!

Config = {}

-- ============================================================================
-- CORE CONFIGURATION
-- ============================================================================
Config.ESX = 'es_extended'
Config.Locale = 'en'
Config.Debug = false -- ONLY USE THIS TO DEBUG ERRORS. Set to false in production.

-- ============================================================================
-- NOTIFICATION SYSTEM CONFIGURATION
-- ============================================================================
-- Options: 'chat', 'ox', 'both'
-- 'chat' = Only chat messages (default FiveM chat)
-- 'ox' = Only ox_lib notifications
-- 'both' = Both chat messages and ox_lib notifications
Config.Notify = 'both'

-- ============================================================================
-- LOGGING CONFIGURATION
-- ============================================================================
Config.EnableChatLog = false -- Enable faction chat logging (ox_lib logging / datadog)

-- ============================================================================
-- SERIAL NUMBER LOOKUP CONFIGURATION
-- ============================================================================
Config.SerialLookupTimeout = 7500 -- Timeout for serial number lookup in milliseconds (5 minutes = 300000)
Config.SerialLookupCheckInterval = 250 -- Interval between checks for serial number in milliseconds
Config.SerialLookupMaxAttempts = 20 -- Maximum number of attempts to find serial number

-- ============================================================================
-- INVENTORY SYSTEM CONFIGURATION
-- ============================================================================
-- Primary inventory system to use. Options: 'ox_inventory', 'esx'
-- If 'ox_inventory' is not available, will fallback to ESX
Config.InventorySystem = 'ox_inventory'

-- ============================================================================
-- UI CONFIGURATION
-- ============================================================================
Config.UIRefreshInterval = 5000 -- Interval in milliseconds to refresh UI data (5 seconds)

-- ============================================================================
-- CHAT CONFIGURATION
-- ============================================================================
Config.FactionChatColor = { 0, 168, 255 } -- RGB color for faction chat messages
Config.FactionChatPrefix = '[Faction Chat]' -- Prefix for faction chat messages

-- ============================================================================
-- PERMISSIONS CONFIGURATION
-- ============================================================================
-- Minimum rank required to invite players (0 = lowest rank, higher = more permissions)
-- Set to nil to allow only highest rank to invite
Config.MinRankToInvite = nil -- nil = only highest rank, or set to a number

-- ============================================================================
-- DATABASE CONFIGURATION
-- ============================================================================
-- These are handled automatically, but you can configure table names if needed
Config.DatabaseTables = {
    PlayerFactions = 'player_factions',
    FactionTiers = 'faction_tiers',
    FactionConfigs = 'faction_configs',
    FactionDropLogs = 'faction_drop_logs'
}

-- ============================================================================
-- COMMANDS CONFIGURATION
-- ============================================================================
Config.Commands = {
    ChatCommand = 'fchat',                    -- Command for faction chat
    FactionCommand = 'faction',               -- Command to show your faction info
    SetFactionCommand = 'setfaction',         -- Admin command to set player faction/rank
    FactionsCommand = 'factions',             -- Command for everyone to view all factions (NEW)
    FMembersCommand = 'fmembers',             -- Command to show online members of your faction (NEW)
    ManagementPanelCommand = 'fmpanel',       -- Admin command to open management panel
    OwnerPanelCommand = 'ownerpanel',          -- Command for faction owners/leaders
    DropLogsCommand = 'droplogs'              -- Admin command to open drop logs panel
}

-- ============================================================================
-- ADMIN GROUPS CONFIGURATION
-- ============================================================================
-- Groups that can access the management panel (/fmpanel)
Config.AdminGroups = {
    'fm',
    'admin',
    'management',
    'director',
    'owner'
}

-- Groups that can use /factions admin command (view all factions - legacy, kept for compatibility)
Config.ViewFactionsGroups = {
    'fm',
    'admin',
    'management',
    'director',
    'owner'
}

-- ============================================================================
-- TIER CONFIGURATION
-- ============================================================================
Config.Tiers = {
    'Trial',
    'Tier 1',
    'Tier 2',
    'Tier 3'
}

-- ============================================================================
-- TIER DROPS CONFIGURATION
-- ============================================================================
-- Configure items that can be given to faction members based on tier
-- Items are configured per tier, and are available to all factions at that tier level
-- Each drop requires: id (unique identifier), item (ox_inventory item name), label (display name), count (amount)
-- The tier is determined by the key in the table (must match Config.Tiers)
Config.TierDrops = {
    ['Trial'] = {
        {
            id = 'ammo_trial',
            item = 'ammo-9',
            label = 'Ammo',
            count = 50
        },
        {
            id = 'pistol_trial',
            item = 'weapon_g2c',
            label = 'Pistol',
            count = 1
        },
        {
            id = 'knife_trial',
            item = 'weapon_knife',
            label = 'Knife',
            count = 1
        },
    },
    ['Tier 1'] = {
        {
            id = 'smg_tier1',
            item = 'weapon_glock40',
            label = 'SMG',
            count = 1
        },
        {
            id = 'microsmg_tier1',
            item = 'weapon_microsmg',
            label = 'Micro SMG',
            count = 1
        },
        {
            id = 'pistol50_tier1',
            item = 'weapon_pistol50',
            label = 'Pistol .50',
            count = 1
        },
    },
    ['Tier 2'] = {
        {
            id = 'assaultrifle_tier2',
            item = 'weapon_assaultrifle',
            label = 'Assault Rifle',
            count = 1
        },
        {
            id = 'carbinerifle_tier2',
            item = 'weapon_carbinerifle',
            label = 'Carbine Rifle',
            count = 1
        },
        {
            id = 'pumpshotgun_tier2',
            item = 'weapon_pumpshotgun',
            label = 'Pump Shotgun',
            count = 1
        },
    },
    ['Tier 3'] = {
        {
            id = 'sniperrifle_tier3',
            item = 'weapon_sniperrifle',
            label = 'Sniper Rifle',
            count = 1
        },
        {
            id = 'heavysniper_tier3',
            item = 'weapon_heavysniper',
            label = 'Heavy Sniper',
            count = 1
        },
        {
            id = 'rpg_tier3',
            item = 'weapon_rpg',
            label = 'RPG',
            count = 1
        },
        {
            id = 'combatmg_tier3',
            item = 'weapon_combatmg',
            label = 'Combat MG',
            count = 1
        },
    }
}

-- ============================================================================
-- LEGACY CONFIG (DEPRECATED - DO NOT USE)
-- ============================================================================
-- The following configs are kept for backwards compatibility but are now managed in the database
-- Factions are now managed in-game via /fmpanel
-- All factions are stored in the database (faction_configs table)
Config.Factions = {}                          -- Empty - managed in database
Config.SetFaction = {}                        -- Empty - managed in database
Config.factionDisplayNames = {}               -- Empty - managed in database
Config.SetAdminFaction = {                    -- Legacy format, use Config.AdminGroups instead
    {'fm', 'admin', 'management', 'director', 'owner'}
}
Config.ViewFactions = Config.ViewFactionsGroups  -- Alias for backwards compatibility

Last updated