RX Scripts Logo
GangWars

Configurables

All config & open sourced files included within this script.

Config Files

--[[
BY RX Scripts © rxscripts.xyz
--]]

Config = {}

Config.Locale = 'en'
Config.DiscordWebhook = ''
Config.UseItem = 'wartablet' -- If false then enables command to open the interface instead of an item
Config.UseMoney = 'bank' -- Money type used for all money transactions

Config.OpenInterfaceCommand = "wartablet" -- Command to open the interface (only if UseItem is false)
Config.EndWagerCommand = "endwar" -- Command to end a war

Config.DisplayEnemyDistance = 100.0 -- From how far the players in active wars sees the enemy visibilities
Config.DisplayEnemyTitle = true
Config.DisplayEnemyMarker = true
Config.KillsToWin = 2 -- How many kills to win the war
Config.WagerMinimum = 100000 -- Minimum wager amount
Config.WagerMaximum = 10000000 -- Maximum wager amount

Config.TabletAnim = { -- Tablet opening animation
    dict = "amb@code_human_in_bus_passenger_idles@female@tablet@base",
    anim = "base",
}

Config.Gangs = { -- Match the key names with the job/gang names from the Jobs table
    ["ballas"] = {
        Label = "Ballas",
        Image = "ballas.png",
        RequiredGrades = { -- Minimum grades required to use the interface for each action
            sendWar = 2,
            revokeWar = 2,
            acceptWar = 2,
            declineWar = 2,
            manageBalance = 2,
        }
    },
    ["bloods"] = {
        Label = "Bloods",
        Image = "bloods.png",
        RequiredGrades = { -- Minimum grades required to use the interface for each action
            sendWar = 2,
            revokeWar = 2,
            acceptWar = 2,
            declineWar = 2,
            manageBalance = 2,
        }
    },
    ["vagos"] = {
        Label = "Vagos",
        Image = "vagos.png",
        RequiredGrades = { -- Minimum grades required to use the interface for each action
            sendWar = 2,
            revokeWar = 2,
            acceptWar = 2,
            declineWar = 2,
            manageBalance = 2,
        }
    },
}

Config.GroupsToEndWagers = { -- Groups that can end wagers with /endwager {gang}
    "superadmin",
    "admin",
    "mod",
}


--[[
    ONLY CHANGE THIS PART IF YOU HAVE RENAMED SCRIPTS SUCH AS FRAMEWORK, TARGET, INVENTORY ETC
    RENAME THE SCRIPT NAME TO THE NEW NAME
--]]
---@type table Only change these if you have changed the name of a resource
Resources = {
    ESX = { name = 'es_extended', export = 'getSharedObject' },
    QB = { name = 'qb-core', export = 'GetCoreObject' },
    AK47GANGS = { name = 'ak47_gangs', export = 'all' },
    RCOREGANGS = { name = 'rcore_gangs', export = 'all' },
    T1GERGANGS = { name = 't1ger_gangsystem', export = 'all' },
    ORIGENILEGAL = { name = 'origen_ilegal', export = 'all' },
    AK47AMBU = { name = 'ak47_ambulancejob', export = false },
    AK47AMBUQB = { name = 'ak47_qb_ambulancejob', export = false },
}
IgnoreScriptFoundLogs = false
AmbulanceIntegratedDeathEvent = false -- Set this to true if you have integrated the death event in your ambulance job to prevent things like double deaths

Opensource Files

All script-related open source code is contained within these files. Third-party components, including frameworks, inventory systems, and other external code, are separately maintained & open sourced in our fmLib repository.
--[[
BY RX Scripts © rxscripts.xyz
--]]

function Notify(msg, type)
    if ESX then
        ESX.ShowNotification(msg, type)
    elseif QB then
        QB.Functions.Notify(msg, type)
    end
end

function IsPlayerLoaded()
    if ESX then
        return ESX.GetPlayerData() and ESX.GetPlayerData().job
    elseif QB then
        return QB.Functions.GetPlayerData() and QB.Functions.GetPlayerData().gang
    end
end

function GetPlayerData()
    if ESX then
        return ESX.GetPlayerData()
    elseif QB then
        return QB.Functions.GetPlayerData()
    end
end

function GetJob()
    if ESX then
        return ESX.GetPlayerData().job
    elseif QB then
        return QB.Functions.GetPlayerData().job
    end
end

function GetIdentifier()
    if ESX then
        return ESX.GetPlayerData().identifier
    elseif QB then
        return QB.Functions.GetPlayerData().citizenid
    end
end

function GetGang()
    if AK47GANGS then
        local gang = AK47GANGS:GetPlayerGang()
        return {
            name = gang.tag,
            rankid = gang.rankid
        }
    elseif RCOREGANGS then
        return RCOREGANGS:GetPlayerGang()
    elseif T1GERGANGS or ORIGENILEGAL then
        return lib.callback.await('gw:getGang', false)
    elseif ESX then
        return GetJob()
    elseif QB then
        return QB.Functions.GetPlayerData().gang
    end
end

function GetGangGrade()
    local gang = GetGang()

    if AK47GANGS then
        return gang.rankid
    elseif RCOREGANGS then
        local identifier = GetIdentifier()
        return gang.identifier == identifier and 2 or 1
    elseif T1GERGANGS or ORIGENILEGAL then
        return lib.callback.await('gw:getGangGrade', false)
    elseif ESX then
        return gang.grade
    elseif QB then
        return gang.grade.level
    end
end

if AK47AMBU then
    RegisterNetEvent('ak47_ambulancejob:onPlayerDeath', function()
        while not LastKillerId do Wait(300) end

        TriggerServerEvent('gw:onDeath', LastKillerId)
        LastKillerId = nil
    end)
end

if AK47AMBUQB then
    RegisterNetEvent('ak47_qb_ambulancejob:onPlayerDeath', function()
        while not LastKillerId do Wait(300) end

        TriggerServerEvent('gw:onDeath', LastKillerId)
        LastKillerId = nil
    end)
end