📝Configurables

Config Files

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

--[[
    HUNTING ZONES CAN BE FOUND IN config/zones.lua
    ANIMALS CAN BE FOUND IN config/animals.lua
    CUT WEAPONS CAN BE FOUND IN config/cutweapons.lua
    LEVELS CAN BE FOUND IN config/levels.lua
    BAITS CAN BE FOUND IN config/usables.lua
    MISSIONS CAN BE FOUND IN config/missions.lua
    TRANSLATIONS CAN BE FOUND IN locales/*.lua
    IN HERE YOU CAN FIND THE MORE GENERIC / NOT VERY LONG LISTS CONFIGURATIONS
--]]

Config = {}

Config.SaveInterval = 10 -- Minutes (Set to 'false' to disable saving on interval, only on server shutdown, or important reached levels)
Config.DiscordWebhook = '' -- Discord webhook to send important logs (Set to '' to disable)
Config.Locale = 'en'
Config.ImgDirectory = 'ox_inventory/web/images/' -- The directory where the images are stored.

Config.CutType = 'target' -- 'melee' or 'keybind' or 'target'
Config.CutKeyMap = { map = 'keyboard', key = 'r' } -- key to start cut if CutType is 'keybind'
Config.CutCooldown = 0 -- Cooldown of cutting in seconds for when you're using CutType 'keybind'

Config.HuntingLicense = {
    enabled = true, -- Set to false to disable the whole hunting license
    buyable = true, -- Set to false to disable buying the license, use exports to give the license to a player
    price = 1500,
    moneyType = 'bank',
    restricts = {
        cutting = true, -- If true, you need a hunting license to cut animals, if false, you can cut animals without a license
        killing = true, -- If true, killing without a license will notify the police and killing will give no benefits
        shopNPC = true, -- If true, you need a hunting license to open the shop NPC
        sellNPC = true, -- If true, you need a hunting license to open the sell NPC
        huntingNPC = true, -- If true, you need a hunting license to open the hunting NPC
    },
}

Config.HuntingNPC = { -- NPC to buy hunting license (if enabled) & see routes, level etc..
    enabled = true, -- Set to false to disable the hunting NPC
    coords = vector3(-1101.1428, 4940.5693, 217.3545),
    heading = 246.7530,
    model = 's_m_y_ammucity_01',
    blip = {
        enabled = true,
        sprite = 141,
        color = 73,
        label = 'Hunter',
        display = 2,
        scale = 0.7,
        shortrange = true,
    },
}

Config.WeaponBlock = { -- These weapons will be blocked for using on other players (to create specifical hunting weapons)
    enabled = true,
    weapons = {
        'WEAPON_KNIFE',
        'WEAPON_SWITCHBLADE',
        'WEAPON_HATCHET',
        'WEAPON_BATTLEAXE',
        'WEAPON_MUSKET',
        'WEAPON_DBSHOTGUN',
        'WEAPON_MARKSMANPISTOL',
        'WEAPON_MARKSMANRIFLE',
    },
}

Config.ShopNPC = { -- NPC that opens a shop
    enabled = true, -- Set to false to disable the shop npc
    route = true, -- If true, the shop NPC will have a route in the hunting npc
    label = 'Hunting Shop',
    moneyType = 'bank',
    model = 's_m_y_ammucity_01',
    coords = vector3(-1075.3329, 4898.0054, 213.2714),
    heading = 357.4609,
    blip = {
        enabled = true,
        sprite = 141,
        color = 73,
        display = 2,
        scale = 0.7,
        shortrange = true,
    },
    categories = {
        ['Baits'] = {
            { item = 'boar_meat',       amount = 1, price = 2500,   label = 'Dead Boar Bait',   requiredLevel = 1,  mystery = false },
            { item = 'deer_horn',       amount = 1, price = 1500,   label = 'Deer Horn',        requiredLevel = 2,  mystery = false },
            { item = 'meat_stand',      amount = 1, price = 5000,   label = 'Meat Stand Bait',  requiredLevel = 2,  mystery = false },
            { item = 'deer',            amount = 1, price = 7500,   label = 'Dead Deer Bait',   requiredLevel = 3,  mystery = true  },
        },
        ['Cut Weapons'] = {
            { item = 'WEAPON_HATCHET',      amount = 1, price = 1000,   label = 'Hatchet',      requiredLevel = 0,  mystery = false },
            { item = 'WEAPON_SWITCHBLADE',  amount = 1, price = 2000,   label = 'Switchblade',  requiredLevel = 1,  mystery = false },
            { item = 'WEAPON_KNIFE',        amount = 1, price = 3000,   label = 'Knife',        requiredLevel = 3,  mystery = true  },
            { item = 'WEAPON_BATTLEAXE',    amount = 1, price = 7000,   label = 'Battleaxe',    requiredLevel = 6,  mystery = true  },
        },
        ['Hunting Weapons'] = {
            { item = 'WEAPON_MARKSMANPISTOL',   amount = 1,     price = 5000,   label = 'Marksman Pistol',          requiredLevel = 0,  mystery = false },
            { item = 'WEAPON_MUSKET',           amount = 1,     price = 10000,  label = 'Musket',                   requiredLevel = 3,  mystery = true  },
            { item = 'WEAPON_DBSHOTGUN',        amount = 1,     price = 15000,  label = 'Double Barrel Shotgun',    requiredLevel = 4,  mystery = true  },
            { item = 'WEAPON_MARKSMANRIFLE',    amount = 1,     price = 20000,  label = 'Marksman Rifle',           requiredLevel = 6,  mystery = true  },
            { item = 'ammo-22',                 amount = 20,    price = 1000,   label = 'Marksman Pistol Ammo',     requiredLevel = 0,  mystery = false },
            { item = 'ammo-musket',             amount = 20,    price = 2000,   label = 'Musket Ammo',              requiredLevel = 3,  mystery = true  },
            { item = 'ammo-shotgun',            amount = 20,    price = 3000,   label = 'Shotgun Ammo',             requiredLevel = 4,  mystery = true  },
            { item = 'ammo-sniper',             amount = 20,    price = 5000,   label = 'Sniper Ammo',              requiredLevel = 6,  mystery = true  },
        },
    },
}

Config.SellNPC = { -- NPC that opens a shop to sell hunting stuff
    enabled = true, -- Set to false to disable the selling shop npc
    route = true, -- If true, the sell NPC will have a route in the hunting npc
    label = 'Hunt Selling',
    moneyType = 'bank',
    model = 's_m_y_ammucity_01',
    coords = vector3(-1112.9452, 4903.7397, 217.5952),
    heading = 310.2702,
    blip = {
        enabled = true,
        sprite = 141,
        color = 73,
        display = 2,
        scale = 0.7,
        shortrange = true,
    },
    categories = { -- Price is per 1
        ['Animals Loot'] = {
            { item = 'animal_fat',      price = 30,   label = 'Animal Fat',     requiredLevel = 0,  mystery = false },
            { item = 'bone_fragments',  price = 50,   label = 'Bone Fragments', requiredLevel = 0,  mystery = false },
            { item = 'raw_pork',        price = 40,   label = 'Raw Pork',       requiredLevel = 0,  mystery = false },
            { item = 'cloth',           price = 80,   label = 'Cloth',          requiredLevel = 0,  mystery = false  },
            { item = 'leather',         price = 200,  label = 'Leather',        requiredLevel = 0,  mystery = false  },
        },
    },
}

--[[
    INITIALIZATION SECTION

    ONLY UNCOMMENT/CHANGE THIS IF YOU HAVE RENAMED SCRIPTS SUCH AS FRAMEWORK, TARGET, INVENTORY ETC
    RENAME THE SCRIPT NAME TO THE NEW NAME
--]]

-- FM = 'fmLib'
-- OXTarget = 'ox_target'
-- QBTarget = 'qb-target'
-- OXInv = 'ox_inventory'
IgnoreResourceNotFoundErrors = false
IgnoreResourceInitializedLogs = false

Opensource Files

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

local cutTargetLabel = 'Cut'

function InitAnimalTargets(animals)
    local opts = {
        {
            label = cutTargetLabel,
            icon = 'fas fa-cut',
        }
    }

    if OXTarget then
        opts[1].name = 'cut' -- don't change this
        opts[1].onSelect = function(data)
            CutAnimal(data.entity)
        end
        opts[1].canInteract = function(entity, distance, coords, name, bone) return not CutOnCd and IsEntityDead(entity) end
        opts[1].distance = 2.5

        OXTarget:addModel(animals, opts)
    elseif QBTarget then
        opts[1].action = function(entity)
            CutAnimal(entity)
        end
        opts[1].canInteract = function(entity, distance, data) return not CutOnCd and IsEntityDead(entity) end

        QBTarget.AddTargetModel(v.model, {
            options = opts,
            distance = 2.5,
        })
    end
end

function RemoveAnimalTargets(animals)
    if OXTarget then
        OXTarget:removeModel(animals, 'cut')
    elseif QBTarget then
        QBTarget:RemoveTargetModel(animals, cutTargetLabel)
    end
end

function AddHuntingNPCTarget(ped)
    if OXTarget then
        OXTarget:addLocalEntity(ped, {
            {
                label = 'Open Hunter',
                name = 'openHuntingNPC',
                icon = 'fas fa-hiking',
                distance = 2.5,
                onSelect = function(data)
                    OpenHuntingUI()
                end,
            }
        })
    elseif QBTarget then
        QBTarget:AddTargetEntity(ped, {
            options = {
                {
                    label = 'Open Hunter',
                    icon = 'fas fa-hiking',
                    targeticon = 'fas fa-hiking',
                    action = function(entity)
                        OpenHuntingUI()
                    end,
                }
            },
            distance = 2.5,
        })
    end
end

function AddShopNPCTarget(npc)
    if OXTarget then
        OXTarget:addLocalEntity(npc, {
            {
                label = 'Open Hunting Shop',
                name = 'openHuntingShop',
                icon = 'fas fa-shopping-cart',
                distance = 2.5,
                onSelect = function(data)
                    OpenShopNPC()
                end,
            }
        })
    elseif QBTarget then
        QBTarget:AddTargetEntity(npc, {
            options = {
                {
                    label = 'Open Hunting Shop',
                    icon = 'fas fa-shopping-cart',
                    targeticon = 'fas fa-shopping-cart',
                    action = function(entity)
                        OpenShopNPC()
                    end,
                }
            },
            distance = 2.5,
        })
    end
end

function AddSellNPCTarget(npc)
    if OXTarget then
        OXTarget:addLocalEntity(npc, {
            {
                label = 'Open Hunting Selling',
                name = 'openHuntingSelling',
                icon = 'fas fa-shopping-cart',
                distance = 2.5,
                onSelect = function(data)
                    OpenSellNPC()
                end,
            }
        })
    elseif QBTarget then
        QBTarget:AddTargetEntity(npc, {
            options = {
                {
                    label = 'Open Hunting Selling',
                    icon = 'fas fa-shopping-cart',
                    targeticon = 'fas fa-shopping-cart',
                    action = function(entity)
                        OpenSellNPC()
                    end,
                }
            },
            distance = 2.5,
        })
    end
end

function RemoveShopNPCTarget(ped)
    if OXTarget then
        OXTarget:removeLocalEntity(ped, 'openHuntingShop')
    elseif QBTarget then
        QBTarget:RemoveTargetEntity(ped, 'Open Hunting Shop')
    end
end

function RemoveSellNPCTarget(ped)
    if OXTarget then
        OXTarget:removeLocalEntity(ped, 'openHuntingSelling')
    elseif QBTarget then
        QBTarget:RemoveTargetEntity(ped, 'Open Hunting Selling')
    end
end

function RemoveHuntingNPCTarget(ped)
    if OXTarget then
        OXTarget:removeLocalEntity(ped, 'openHuntingNPC')
    elseif QBTarget then
        QBTarget:RemoveTargetEntity(ped, 'Open Hunter')
    end
end

function StartCutProgress(animalNetId, weaponHash)
    if FM.progress.start({
        label = 'Cutting..',
        time = 1000,
        canCancel = true,
        type = 'circle',
        failedLabel = 'Cutting failed!',
        completedLabel = 'Cutting completed!',
        anim = {
            dict = 'melee@knife@streamed_core',
            anim = 'ground_attack_on_spot',
        },
    }) then
        CutAnimalByProgress(animalNetId, weaponHash)
    else
        CutOnCd = false
    end
end

function GetFullPlayerName()
    return FM.callback.sync('hunting:getFullPlayerName')
end

function GetPlacingBaitCoords()
    local coords = GetEntityCoords(PlayerPedId())
    local forward = GetEntityForwardVector(PlayerPedId())
    coords = coords + forward
    local ret, z = GetGroundZFor_3dCoord(coords.x, coords.y, coords.z, 0, false)
    coords = vector3(coords.x, coords.y, z)
  
    local heading = GetEntityHeading(PlayerPedId())

    return coords, heading
end

function PlayPlaceBaitAnim()
    FM.anim.play({
        anim = 'base',
        dict = 'amb@world_human_gardener_plant@male@base',
        duration = 3000,
    })
end

Last updated