Territories

Territories brings gang-controlled zones and drug labs to your server in a highly configurable fashion.

Info

Territories is a modern refresh of a well-known gang territory control script.

Each zone/territory is highly configurable, facilitating group and job access restrictors (so you can configure each zone to only be influence-able by certain groups). Each territory can have access to multiple labs, which use routing buckets on entrance to allow repeat use of the same lab multiple times across the resource with no conflicts.

Labs can be configured with multiple actions, which can also be re-used across multiple labs. This makes it possible to configure multiple entrances to different labs, which use the same interior, while allowing different actions in each lab. An example of this would be creating a lab with only a production action point, and giving access to all ranks/grades of a job/gang, while setting up a restricted lab to the highest rank/grades with access to the packaging action. This would force players to interact with higher/lower ranking members of their organization in order to complete the production process.

Influence over a territory is gained through player population dominance in a territory, PvP (killing another player) where enabled inside a territory, and exports have been provided to further influence the zone through known actions (selling drugs) or dynamic unknown actions (such as graffiti/tagging, etc).

A large improvement since "Territories V1" (ModFreakz resource) is the simplified action additions. This should allow you to move, replace, and clone existing actions with little coding knowledge. Copy/paste, and change some coordinates is all that's required to duplicate an action.

Setup

Installation

QB-Core

Change the following event in qb-ambulancejob/client/dead.lua:

AddEventHandler('gameEventTriggered', function(event, data)
    if event == "CEventNetworkEntityDamage" then
        local victim, attacker, victimDied, weapon = data[1], data[2], data[4], data[7]
        if not IsEntityAPed(victim) then return end
        if victimDied and NetworkGetPlayerIndexFromPed(victim) == PlayerId() and IsEntityDead(PlayerPedId()) then
            if not InLaststand then
                SetLaststand(true)
            elseif InLaststand and not isDead then
                SetLaststand(false)
                local playerid = NetworkGetPlayerIndexFromPed(victim)
                local playerName = GetPlayerName(playerid) .. " " .. "("..GetPlayerServerId(playerid)..")" or Lang:t('info.self_death')
                local killerId = NetworkGetPlayerIndexFromPed(attacker)
                local killerName = GetPlayerName(killerId) .. " " .. "("..GetPlayerServerId(killerId)..")" or Lang:t('info.self_death')
                local weaponLabel = QBCore.Shared.Weapons[weapon].label or 'Unknown'
                local weaponName = QBCore.Shared.Weapons[weapon].name or 'Unknown'
                TriggerServerEvent("qb-log:server:CreateLog", "death", Lang:t('logs.death_log_title', {playername = playerName, playerid = GetPlayerServerId(playerid)}), "red", Lang:t('logs.death_log_message', {killername = killerName, playername = playerName, weaponlabel = weaponLabel, weaponname = weaponName}), GetPlayerServerId(killerId))
                deathTime = Config.DeathTime
                OnDeath()
                DeathTimer()
            end
        end
    end
end)

Config

All of the config vars found below are stored within the config.lua file.

config = {
    -- Minutes until zone can be re-captured by another gang after capture.
    seizeCooldown = 1,    

    influenceModifiers = {
        players = 5,   -- receive X influence/reputation every influenceTick for each player in the territory.
        murder  = 5,   -- receive X influence/reputation for every PVP kill in a territory.
        sale    = 5    -- receive X influence/reputation for every sale in a territory.
    },

    -- How often should influence/reputation be calculated on the server side?
    -- NOTE: This will re-sync to all clients every X ms. A higher value will prevent excessive network load.
    influenceTick = 1000,

    -- Options for HUD text.
    hud = {
        render  = true,
        x       = 0.8,
        y       = 0.8,
        width   = 0.2,
        height  = 0.2,
        scale   = 0.4,
        centre  = false,
        right   = true,
        font    = 4,
        r       = 255,
        g       = 255,
        b       = 255,
        a       = 255,

        showController      = true,
        showReputation      = true,
        showSeizedAt        = true,
        showLastLogin       = true,
    },

    -- Area blip colors for job/group/gang
    areaBlipColors = {
        police = 74,
        ballas = 50,
        grove  = 69,
        vagos  = 60,
        mc     = 59
    }
}

Territories

All territories are stored within the data/territories.lua file.

Territories are the definitions of each controllable zone. You can add or remove to the existing territories as you please. Use the existing examples as a guide.

For more information, read the documentation.

Labs

All labs are stored within the data/labs.lua file.

Labs are the zone in which actions can be performed. There is little configuration for these besides a position and list of accessible actions.

For more information, read the documentation.

Actions

All actions are stored within the data/actions.lua file.

Actions are the point in which you will interact with the labs. Each action can be referenced multiple times across multiple different labs with no conflict.

For more information, read the documentation.

Items

All items are stored within the data/items.lua file.

All item definitions are stored in the items table. On resource start, this table assures all items required by this resource are existing in your server. It also provides a direct lookup to item labels relevant to this resource.

For more information, read the documentation.

Labels

All labels and translations can be found within the labels.lua file.

en = {
    action_complete = "Action complete.",
    gained_items = "Received %ix %s",
    missing_items = "Missing %ix %s",
    ...
}

Usage

  • Some basic options are found within the config.lua file (as listed above).

  • All translations are handled in the labels.lua file.

  • Check out the Territories, Labs, Items and Actions documentation for further configuration.

Conflicting Resources

  • None known.

Dependencies

Last updated