Exports & API

Exports & API

legends_airdrop provides exports for framework and targeting system detection, plus customizable functions in the editable files.

Shared Exports

GetFramework

Returns the detected framework type.

local framework = exports['legends_airdrop']:GetFramework()

Returns: string

  • 'qbox' - QBox detected
  • 'qbcore' - QB-Core detected
  • 'esx' - ESX detected
  • 'standalone' - No framework detected

Example:

local framework = exports['legends_airdrop']:GetFramework()
 
if framework == 'qbcore' then
    -- QB-Core specific code
elseif framework == 'esx' then
    -- ESX specific code
end

GetTargeting

Returns the detected targeting system.

local targeting = exports['legends_airdrop']:GetTargeting()

Returns: string or nil

  • 'ox_target' - ox_target detected
  • 'qb-target' - qb-target detected
  • nil - No targeting system detected

Customizable Functions

The following functions in editable/client.lua can be customized to integrate with your server's systems:

StartAirdropMinigame

Override the minigame with your preferred implementation.

function StartAirdropMinigame()
    -- Default: ox_lib skillcheck
    local difficulty = Config.NPCSettings.minigame.difficulty
    local inputs = Config.NPCSettings.minigame.inputs
 
    local success = lib.skillCheck(difficulty, inputs)
 
    return success
end

Alternative Examples:

-- ps-ui circle minigame
function StartAirdropMinigame()
    return exports['ps-ui']:Circle(3, 10)
end
 
-- qb-skillbar
function StartAirdropMinigame()
    return exports['qb-skillbar']:GetSkillbarObject().SkillCheck()
end
 
-- memorygame
function StartAirdropMinigame()
    return exports['memorygame']:thermiteminigame(10, 3, 3, 10)
end

CollectCrateProgress

Customize the progress bar appearance when collecting crates.

function CollectCrateProgress(duration)
    return lib.progressBar({
        duration = duration,
        label = Locale.Get('progress.collecting'),
        useWhileDead = false,
        canCancel = true,
        disable = {
            car = true,
            move = true,
            combat = true
        },
        anim = {
            dict = 'mini@repair',
            clip = 'fixing_a_player'
        }
    })
end

ShowNotification

Customize notification display to match your server's style.

function ShowNotification(title, message, type)
    -- Default handles all frameworks automatically
    -- Replace with your custom notification system:
 
    -- Example: okokNotify
    exports['okokNotify']:Alert(title, message, 5000, type)
 
    -- Example: Custom NUI notification
    SendNUIMessage({
        action = 'notify',
        title = title,
        message = message,
        type = type
    })
end

Localization

Language strings are stored in lang/en.json:

{
    "notifications": {
        "title": "Airdrop",
        "airdrop_in_progress": "An airdrop is already in progress",
        "cooldown_message": "Airdrop is on cooldown. Wait %s minutes",
        "missing_item": "You need a %s to call an airdrop",
        "minigame_failed": "Minigame failed! Airdrop not called",
        "minigame_success": "An airdrop has been called! Check your map!",
        "airdrop_collected": "You have collected the airdrop!"
    },
    "target": {
        "request_airdrop": "Request Airdrop",
        "collect_airdrop": "Collect Airdrop"
    },
    "progress": {
        "collecting": "Collecting airdrop..."
    },
    "blips": {
        "airdrop_plane": "Airdrop Plane",
        "airdrop_falling": "Airdrop (Falling)",
        "airdrop_contact": "Airdrop Contact"
    }
}

Adding a New Language

  1. Create a new file in lang/ (e.g., lang/es.json)
  2. Copy structure from en.json and translate
  3. Set Config.Language = 'es' in config

Integration Examples

Notification on Airdrop Spawn

-- In editable/server.lua, you can add custom logic when airdrops spawn
function OnAirdropCalled(locationId, playerName)
    -- Add your custom notification logic here
    -- For example, send to Discord webhook
end

Custom Reward Logic

Rewards are configured per-location in config.lua. You can adjust:

  • Item names
  • Chance percentages (0-100)
  • Min/max quantities
rewards = {
    ['item_name'] = {
        chance = 75,  -- 75% chance
        min = 5,      -- Minimum 5
        max = 10,     -- Maximum 10
    }
}

Need Help?

Join our Discord for support: discord.gg/lgnds (opens in a new tab)


Legends Store - Premium FiveM Scripts