HEX
HexscriptsClassicLootdrop

Configurations

Here you will get all configurations & open source files that are included within this script.

Config Files

Config = {}

Config.Debug = false
Config.Locale = 'automatic'
Config.Framework = 'automatic' -- automatic, esx, qbcore, standalone

Config.ServerName = 'HEXSCRIPTS'

Config.UnemployedJob = 'unemployed' -- job that counts as "no job"
Config.CrimeJobs = { 'ballas', 'vagos' } -- jobs that can join lootdrops with eligibility = 'crime' | if you use hex_jobscreator, its jobs of the type gang, mafia and cartel are added automatically

Config.BaseDimension = 500 -- routing bucket of a lootdrop = BaseDimension + drop id, gulag fights use the buckets 1000 above it

Config.Types = {
    ['faction'] = {
        command = 'lootdrop_faction', -- admin command that starts this lootdrop
        eligibility = 'job', -- job (every job except Config.UnemployedJob), unemployed, crime (Config.CrimeJobs), everyone
        label = 'type_faction' -- locale key or plain text
    },

    ['civilian'] = {
        command = 'lootdrop_civilian',
        eligibility = 'unemployed',
        label = 'type_civilian'
    }
}

Config.Zone = {
    startRadius = 270.0, -- zone radius during the join phase
    minRadius = 30.0, -- the zone never gets smaller than this
    openableRadius = 130.0, -- the crate can be torched open once the zone is this small
    shrinkIntervalSeconds = 120,
    shrinkAmount = 35.0,
    outsideDamagePerTick = 5, -- damage per second outside of the zone after the join phase
    closedSphere = { r = 255, g = 155, b = 0 },
    openSphere = { r = 255, g = 163, b = 30 },
    joinSphere = { r = 255, g = 163, b = 30 },
    sphereAlpha = 0.4,
    sphereDrawDistance = 750.0
}

Config.Blips = {
    sprite = 164,
    scale = 1.0,
    joinScale = 1.2,
    joinColour = 5,
    joinRouteColour = 5,
    closedColour = 1,
    openColour = 2,
    zoneClosedColour = 1,
    zoneOpenColour = 17,
    zoneAlpha = 110,
    nextZoneColour = 0,
    nextZoneAlpha = 70
}

Config.Waypoint = {
    enabled = true, -- 3D waypoint on a joinable lootdrop, only shown when the resource hex_waypoints is started
    icon = 'parachute-box',
    color = '#ff3636',
    drawDistance = 10000.0
}

Config.TorchMarker = {
    type = 1,
    height = 1.0,
    color = { r = 0, g = 0, b = 0, a = 155 }
}

Config.Timing = {
    joinPhaseSeconds = 600,
    torchTimeSeconds = 180,
    gulagWaitTimeSeconds = 180,
    gulagCountdownSeconds = 5,
    gulagFightTimeSeconds = 300
}

Config.OutsideKickSeconds = 6 -- join phase: seconds outside of the zone until the player leaves the lootdrop
Config.ParachuteGraceSeconds = 30 -- same timer for gulag winners who are still gliding back

Config.TorchRadius = 15.0 -- the torching player has to stay inside this radius around the crate
Config.InteractKey = 38 -- E
Config.InteractDistance = 3.0

Config.ContainerProp = `m23_1_prop_m31_crate_tech_01a` -- needs game build 2944 or newer

Config.ParachuteHeight = 200.0 -- gulag winners drop in this high above the crate

Config.Fade = {
    duration = 800,
    maxHold = 15000
}

Config.ExitSpawn = vector4(373.788, -1610.109, 29.292, 51.254) -- players are brought here when they are eliminated or the lootdrop ends, false = back to where they joined

Config.Heal = {
    health = 200,
    armour = 100
}

Config.SpawnLocations = {
    { label = 'Harbor', coords = vector3(1072.288, -3142.151, 5.901) },
    { label = 'Kortz Hill', coords = vector3(-2343.335, 1361.2, 335.299) },
    { label = 'Paleto', coords = vector3(-107.857, 6380.618, 36.797) },
    { label = 'Quarry', coords = vector3(2774.203, 2860.332, 35.186) },
    { label = 'Oil Fields', coords = vector3(1712.124, -1639.733, 112.484) },
    { label = 'Kortz Center', coords = vector3(-2245.589, 263.367, 174.615) },
    { label = 'Casino Hill', coords = vector3(1618.992, 426.433, 254.849) },
    { label = 'Stab City', coords = vector3(46.018, 3631.008, 39.831) },
    { label = 'Grapeseed', coords = vector3(1898.979, 4829.352, 45.837) },
    { label = 'Wind Farm', coords = vector3(2211.064, 2063.947, 132.294) },
    { label = 'Alien Hill', coords = vector3(2622.337, 3709.669, 95.54) },
    { label = 'Army Base', coords = vector3(-2119.545, 2537.821, 3.028) },
    { label = 'FIB', coords = vector3(2384.385, -936.887, 151.945) }
}

Config.AllowedWeapons = { -- every other weapon is put away inside a lootdrop
    [`WEAPON_PISTOL`] = true,
    [`WEAPON_SNSPISTOL`] = true
}

Config.Gulag = {
    spawns = {
        {
            spawnA = vector4(-0.014, 1892.9, 210.865, 82.71),
            spawnB = vector4(-189.248, 1918.158, 197.244, 263.763)
        },

        {
            spawnA = vector4(-495.692, 1494.983, 384.425, 310.822),
            spawnB = vector4(-449.699, 1533.094, 388.049, 108.97)
        }
    },

    doubleFightPlayerCount = 12, -- more players than this inside the lootdrop = 2 vs 2 gulag fights

    sameJobWaitSeconds = 15, -- waits this long for an opponent with another job before two players of the same job fight
    winnerSpawnSpread = 8.0,
    winnerSpawnHeightStep = 4.0
}

Config.DeathCauses = { -- death reasons for killfeed and logs (locale key or plain text), weapons missing here use the label of your framework
    [`WEAPON_UNARMED`] = 'death_melee',
    [`WEAPON_FALL`] = 'death_fall',
    [`WEAPON_RUN_OVER_BY_CAR`] = 'death_vehicle',
    [`WEAPON_RAMMED_BY_CAR`] = 'death_vehicle',
    [`WEAPON_DROWNING`] = 'death_drowning',
    [`WEAPON_DROWNING_IN_VEHICLE`] = 'death_drowning',
    [`WEAPON_FIRE`] = 'death_fire',
    [`WEAPON_EXPLOSION`] = 'death_explosion'
}

Config.Hud = {
    top = 2.4 -- distance of the lootdrop HUD to the top of the screen in vh
}

Config.Killfeed = {
    enabled = true,
    right = 2.0, -- distance to the right side of the screen in vh
    bottom = 24.0 -- distance to the bottom of the screen in vh
}

Client Open Source Files

if Config.Framework == 'automatic' then
    if GetResourceState('es_extended') == 'started' then
        Config.Framework = 'esx'
    elseif GetResourceState('qb-core') == 'started' then
        Config.Framework = 'qbcore'
    else
        Config.Framework = 'standalone'
    end
end

function DrawHelpNotify(message)
    if GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:HelpNotify(message)
    elseif GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:HelpNotify(message)
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:HelpNotify(message)
    elseif GetResourceState('hex_1_hud') == 'started' then
        exports['hex_1_hud']:HelpNotify(message)
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:HelpNotify(message)
    else
        SetTextComponentFormat('STRING')
        AddTextComponentString(message)
        DisplayHelpTextFromStringLabel(0, 0, 1, -1)
    end
end

function Notify(title, message, notifyType, timeout)
    if timeout == nil then timeout = 5000 end
    if notifyType == nil then notifyType = 'info' end

    if GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:Notify(title, message, notifyType, timeout)
    elseif GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:Notify(title, message, notifyType, timeout)
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:Notify(title, message, notifyType, timeout)
    elseif GetResourceState('hex_1_hud') == 'started' then
        exports['hex_1_hud']:Notify(title, message, notifyType, timeout)
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:Notify(title, message, notifyType, timeout)
    elseif GetResourceState('hex_hud') == 'started' then
        exports['hex_hud']:Notify(title, message, notifyType, timeout)
    else
        ShowFrameworkNotify(title, message, notifyType, timeout)
    end
end

function HideHud()
    if GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:HideHud(true)
    elseif GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:HideHud(true)
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:HideHud(true)
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:HideHud(true)
    elseif GetResourceState('hex_hud') == 'started' then
        exports['hex_hud']:HideHud(true)
    end
end

function ShowHud()
    if GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:HideHud(false)
    elseif GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:HideHud(false)
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:HideHud(false)
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:HideHud(false)
    elseif GetResourceState('hex_hud') == 'started' then
        exports['hex_hud']:HideHud(false)
    end
end

function CreateJoinWaypoint(coords, label)
    if not Config.Waypoint.enabled then return nil end
    if GetResourceState('hex_waypoints') ~= 'started' then return nil end

    return exports['hex_waypoints']:CreateWaypoint({ coords = coords, type = 'checkpoint', label = label, icon = Config.Waypoint.icon, color = Config.Waypoint.color, dynamicScaling = true, drawDistance = Config.Waypoint.drawDistance, groundZ = coords.z - 1.0 })
end

function RemoveJoinWaypoint(waypointId)
    if not waypointId then return end
    if GetResourceState('hex_waypoints') ~= 'started' then return end

    exports['hex_waypoints']:RemoveWaypoint(waypointId)
end

function ResetTimecycle()
    ClearTimecycleModifier()
end

Server Open Source Files

if Config.Framework == 'automatic' then
    if GetResourceState('es_extended') == 'started' then
        Config.Framework = 'esx'
    elseif GetResourceState('qb-core') == 'started' then
        Config.Framework = 'qbcore'
    else
        Config.Framework = 'standalone'
    end
end