Skip to main content

Mastering Your FFA Script: Configuration Guide

The FFA Script offers extensive customization options via its configuration files, primarily config.lua and discord.lua. This guide will walk you through each section to help you tailor the script perfectly to your server’s needs.
Always create a backup of your configuration files before making significant changes to avoid losing your settings.

Framework Integration

These settings control how the FFA script integrates with your server’s framework (ESX or QBCore).

Basic Framework Setup

Choose between ESX and QBCore frameworks:
-- Framework Selection
Config.FrameWork = "ESX"  -- Options: "ESX" or "QBCORE"
Config.GiveWeaponsServerSideFrameWork = "esx"  -- Options: "esx" or "qbcore"

-- Only required if using a custom ESX prefix
Config.CustomESXPrefixEvents = "esx"

Framework Initialization Functions

-- Server-side initialization
Config.InitServer = function()
    if Config.FrameWork == "ESX" then
        ESX = nil
        ESX = exports["es_extended"]:getSharedObject()
    else
        QBCore = exports["qb-core"]:GetCoreObject()
    end
end

-- Client-side initialization
Config.InitClient = function() 
    if Config.FrameWork == "ESX" then
        ESX = nil
        ESX = exports["es_extended"]:getSharedObject()
    else
        QBCore = exports["qb-core"]:GetCoreObject()
    end
end
If you’re using an older version of ESX that uses events instead of exports, modify the initialization functions to use TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) instead.

Inventory System Options

Configure how weapons are given and handled with your inventory system:
-- For ESX with QS Inventory
Config.QSInventory = false

-- Controls whether weapons are given server-side or client-side
Config.GiveWeaponsServerSide = true

-- Weapon giving function for server-side
Config.GiveWeaponServerSideEvent = function(source, weapon, ammo)
    if Config.GiveWeaponsServerSideFrameWork == "esx" then
        local xPlayer = ESX.GetPlayerFromId(source)
        xPlayer.addWeapon(weapon, ammo)
        
        -- For QS Inventory, you might use:
        -- xPlayer.addInventoryItem(weapon, 1)
    else
        -- QBCore inventory method
        local Player = QBCore.Functions.GetPlayer(source)
        local info = {ammo = ammo}
        Player.Functions.AddItem(weapon, 1, false, info)
    end
end
Different inventory systems require different approaches for handling weapons. If you’re using a custom inventory system, you may need to modify these functions to match your system’s requirements.

Inventory Clearing Functions

Config.ClearInventoryFunction = function()
    if Config.FrameWork == "ESX" then
        if Config.QSInventory then
            TriggerServerEvent('ffa:clearQSInventory')
        else
            RemoveAllPedWeapons(PlayerPedId())
        end
    else
        SetCurrentPedWeapon(PlayerPedId(), GetHashKey("WEAPON_UNARMED"), true)
        TriggerServerEvent('ffa:clearQBInventory2')
    end
end

General Settings

Configure the core functionality and behavior of the FFA script.

Server and Debug Settings

Config.Debug = true  -- Enable for additional debugging information
Config.AdvancedDebug = true  -- Enable for more detailed debugging

Config.ServerName = "Your Server"  -- Your server name displayed in various messages
Config.SavePlayerTime = 60000  -- How often player data is saved (in milliseconds)

Config.OpenMenuKey = 38  -- Key code for opening the FFA menu (38 = E)
Config.OpenTimeout = 100  -- Cooldown between menu opens (in milliseconds)

Money and Economy Settings

-- Money handling options
Config.GiveMoneyOnKillToBank = false  -- If true, kill rewards go to bank instead of cash
Config.RemoveMoneyFromBankOnJoin = false  -- If true, join fee is taken from bank instead of cash
Find key codes for Config.OpenMenuKey in the FiveM documentation.

Respawn Configuration

-- Respawn screen settings
Config.RespawnScreen = true  -- Show respawn countdown screen
Config.RespawnCountdown = 4  -- Respawn countdown in seconds
Config.RespawnInstant = false  -- Instantly respawn without countdown
Config.SameRespawnCoords = false  -- Prevent respawning at the same coordinates twice

-- Out of zone settings
Config.OutZoneScreen = true  -- Show out-of-zone countdown screen
Config.OutZoneCountdown = 5  -- Out-of-zone countdown in seconds
Config.OutZoneRespawnInstant = false  -- Instantly respawn when out of zone

-- In-game HUD settings
Config.IngameHud = true  -- Show the in-game HUD for FFA

Combat Settings

-- Anti-combat logging
Config.AntiCombat = true  -- Enable anti-combat logging protection
Config.AntiCombatTimeout = 3000  -- Combat status duration in milliseconds

Default Player Options

Config.DefaultPlayerOptions = {
    notifications = true,  -- Show notifications
    anonym = false,  -- Anonymous mode
    hud = true,  -- Show HUD
    fullplaytime = true,  -- Track full playtime
    crosshair = false,  -- Show crosshair
    hitmarker = false  -- Show hitmarker
}

Config.AlwaysShowCrosshair = true  -- If true, crosshair is always shown when enabled
Config.LeaderboardMaxPlayers = 99  -- Maximum players shown on leaderboard

Weapon Settings

-- Weapon ammo settings
Config.WeaponAmmo = 5000  -- Amount of ammo given when spawning
Config.LeaveAmmo = 200  -- Amount of ammo given when leaving FFA

-- Give weapon once on spawn or every respawn
Config.GiveWeapon1TimeOnSpawn = true
Weapon settings control how and when players receive weapons in FFA zones, along with ammo quantities. Adjust these based on your server’s gameplay style.

Gameplay Features

Configure special gameplay features like killstreaks, hitmarkers, and special event handlers.

Killstreak Configuration

-- Killstreak thresholds that trigger notifications
Config.KillStreak = {
    3, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60,
}

-- Custom notification function for killstreaks
Config.KillStreakNotification = function(streak)
    TriggerEvent("esx:showNotification", "KILLSTREAK: " .. streak)
    
    -- Example of giving reward for specific streaks
    if streak == 12 then
        GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_ASSAULTRIFLE"))
    end
end
You can customize killstreak rewards to offer special weapons, armor, or other bonuses at specific streak milestones.

Hitmarker & Notification Settings

-- Hitmarker configuration
Config.HitMarkerColor = {120, 0, 0}  -- RGB color for hitmarkers

-- Custom hitmarker sound (if desired)
Config.OnHitmarker = function()
  -- Requires InteractSound resource
  -- TriggerEvent("InteractSound_CL:PlayOnOne", "hitmarker", 1)
end

-- Standard notification function
Config.Notification = function(text)
  TriggerEvent("esx:showNotification", text)
end

-- Help bar notification
Config.showInfoBar = function(text)
  SetTextComponentFormat("STRING")
  AddTextComponentString(text)
  DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end

Map Locations & Zones

Configure FFA markers on the map and define combat zones with their properties.

Map Marker Configuration

FFA markers are the points where players interact to enter FFA zones:
Config.FFAMarker = {
    FFA1 = {
        ShowMarker = true,  -- Show the 3D marker in the world
        ShowBlip = true,    -- Show on the minimap/map

        UseJob = false,     -- Restrict to specific job
        Jobname = "police", -- Job name if UseJob = true

        -- Marker appearance and location
        Marker = {
            Coords = vector3(-420.356, 1142.452, 324.8536),  -- Location
            DrawDistance = 20.0,   -- Distance at which marker becomes visible
            Scale = vector3(1.5, 1.5, 1.0),  -- Size
            Colour = {r = 102, g = 102, b = 204},  -- Color
            Alpha = 100,     -- Transparency
            Type = 1,        -- Marker type
            MSG = "Press ~INPUT_CONTEXT~ to open the menu",  -- Interaction hint
        },

        -- Map blip configuration
        Blip = {
            Coords = vector3(-420.356, 1142.452, 324.8536),  -- Location
            Sprite = 175,    -- Blip icon ID
            Display = 4,     -- Display behavior
            Scale = 1.0,     -- Size
            Colour = 2,      -- Color
            Name = "FFA",    -- Label on map
        },
    },

    -- You can add more markers by adding FFA2, FFA3, etc.
}
For marker and blip types, colors, and other options, refer to the FiveM documentation on markers and blips.

Combat Zone Configuration

FFA zones define the combat areas where players fight:
Config.Zones = {
    Zone0 = {
        Name = "Only Pistol",  -- Zone name displayed to players
        Desc = "Pistols only zone with limited weapons.",  -- Description
        AddedDate = "29.06.2022",  -- When the zone was added

        MaxPlayers = 10,  -- Maximum players allowed in this zone

        -- Dimension settings (requires OneSync Infinity)
        Dimension = true,  -- Use separate dimension for this zone
        DimensionID = 10000,  -- Unique dimension ID (must be different for each zone)

        -- Visual representation of zone boundaries
        ShowZone = true,  -- Show zone boundaries
        ZoneHeight = 25,  -- Height of zone visualization
        ZoneAlpha = 90,   -- Transparency
        ZoneColor = {r = 69, g = 255, b = 141},  -- RGB color

        -- Zone boundary coordinates (vertices of the zone)
        ZoneCoords = {
            {-154.50605773926, -937.58984375, 253.3971862793},
            {-157.92643737793, -948.24786376953, 252.89315795898},
            -- Additional coordinates...
        },

        -- Spawn points within the zone
        Spawnpoints = {
            {-159.85989379883, -990.80316162109, 254.13130187988},
            {-185.45248413086, -1008.3400268555, 254.33544921875},
            -- Additional spawn points...
        },

        -- Weapon settings for this zone
        OwnWeapons = false,  -- Allow players to use their own weapons
        Weapons = {  -- Available weapons in this zone
            "WEAPON_PISTOL",
            "WEAPON_PISTOL_MK2",
            "WEAPON_COMBATPISTOL",
            -- Additional weapons...
        },
    },

    -- You can add more zones by adding Zone1, Zone2, etc.
}
Each zone should have a unique DimensionID to prevent players in different zones from seeing each other. Make sure your server has OneSync Infinity enabled for the dimension feature to work.

Game Modes & Economy

Configure different game modes with their own rules and economy settings.

Available Game Modes

Config.Gamemode = {
    Gamemode1 = {
        Name = "Hardcore",
        Desc = "Es gelten die selben Regeln wie im normalen Spielmodus, stirbst du, verlierst du <span>ALL</span> dein <span>GELD</span> was du dabei hast! Für jede Eliminierung die du erzielst, erhälst du <span>$90,000</span> auf deinem Konto gut geschrieben!",
        Death = "Alles Geld Verlieren",

        JoinPrice = 20000,  -- Cost to join this game mode
        KillReward = 90000,  -- Money reward per kill
    },

    Gamemode2 = {
        Name = "Normal",
        Desc = "Es gelten die typischen FFA Regeln! Du kannst durch das spielen von FFA auszeichnungen erhalten. Durch das erbringen von Auszeichnungen erhälst du weitere Belohnungen!",
        Death = "Garnichts :)",

        JoinPrice = 10000,
        KillReward = 35000,
    },

    // Add more game modes as needed
}
Create game modes with different risk/reward profiles to appeal to different player types. High-risk modes like Hardcore can create exciting tension, while Normal modes can be more accessible.

Discord Integration

Configure Discord webhook integration for announcements and logging.

Basic Discord Setup

Config.DiscordLogs = true

Config.LeaderBoard = true
Config.LeaderBoardColor = 65280
Config.LeaderBoardWebhook = ""
Config.LeaderBoardSendTimeout = 18000000 --Every 5 hours
Config.LeaderBoardTop = 10

Config.KillWebhook = ""
Config.KillStreakWebhook = ""
Config.JoinWebhook = ""
Config.LeaveWebhook = ""

Config.KillColor = 65280
Config.StreakColor = 65280
Config.JoinColor = 65280
Config.LeaveColor = 65280

Config.Username = "Dein Server"
Config.Avatar = "https://cdn.discordapp.com/attachments/428282615720706048/1038175444685561946/logo2.png"
Config.Title = "Dein Server"
Config.CommuntiyLogo = "https://cdn.discordapp.com/attachments/428282615720706048/1038175444685561946/logo2.png"
Config.FooterIcon = "https://cdn.discordapp.com/attachments/428282615720706048/1038175444685561946/logo2.png"
Config.Thumbnail = "https://cdn.discordapp.com/attachments/428282615720706048/1038175444685561946/logo2.png"
Config.FooterText = "FFA Logs"

Discord webhooks allow your server to automatically post FFA events, leaderboards, and other important information to your Discord server. This helps keep your community engaged and aware of in-game activities.

🚀 Pro Tips for Optimization

Take your FFA setup to the next level with these advanced strategies:
  • Balance Game Modes: Create a mix of high-risk/high-reward and low-risk/low-reward game modes to appeal to different player preferences.
  • Strategic Zone Placement: Place FFA zones away from important roleplay areas to avoid disrupting RP experiences.
  • Weapon Progression: Consider creating zones with progressively better weapons that cost more to enter, creating a sense of progression.
  • Custom Rewards: Use the Config.KillStreakNotification function to give unique rewards for impressive killstreaks.
  • Seasonal Events: Temporarily modify zone settings, game modes, or rewards to create special seasonal events.
Remember to restart the resource after making configuration changes for them to take effect.