đŸ”Ŧ
RX Scripts
STOREDISCORD
  • 👋Overview
  • Find us
    • 🔗Store
    • 🔗Discord
    • 🔗Youtube
  • 🌐Scripts
    • Garages
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Reports PRO
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Mining
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Fishing
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Player Stores
      • đŸ› ī¸Installation
      • 🚚Jobs DLC
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Drug Labs
      • đŸ› ī¸Installation
      • âœˆī¸Operation DLC
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Hunting
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Plantation
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Gang Wars
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Šī¸Events
    • Housing
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Šī¸Events
    • Chopshop
      • đŸ› ī¸Installation
      • 📝Configurables
    • Death System
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Šī¸Events
    • Recyclers
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Smelters
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Crates & Storages
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Šī¸Exports
      • â†Šī¸Events
    • Black Markets
      • đŸ› ī¸Installation
      • 📝Configurables
    • Hazard Zones
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Report System
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Billing System
      • đŸ› ī¸Installation
      • â†Ēī¸Exports
      • â†Šī¸Events
Powered by GitBook
On this page
  • Config Files
  • Opensource Files
  1. Scripts
  2. Drug Labs

Configurables

Config Files

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

Config = {}

--[[ 
    YOU CAN CREATE THE DRUGLABS IN config/labs/**.lua FILES
--]]
Config.DrugLabs = {}

Config.SaveInterval = 10 -- saves data every x minutes
Config.Locale = 'en'
Config.DefaultRoutingBucket = 0 -- default routing bucket for players

Config.MaxLabsOwned = 1 -- how many labs can a player own
Config.SellPercentage = 0.75 -- percentage of the lab price to return to the player when selling
Config.UseMoney = 'black_money' -- money type to purchase lab

Config.CopsRaid = { -- raid settings for the cops, minigame/progress duration etc can be changed in client/opensource.lua)
    enabled = true,
    openDoorDuration = 3, -- in minutes (how long will the door be open for everyone, after this the lab will be disabled for the cooldown below)
    labDisabledCooldown = 60 * 24, -- in minutes (how long will the lab be disabled to use after a raid)
    copsRequired = 1, -- how many cops are required to be online to raid a lab, takes job from Config.CopsRaid.allowedJob
    allowedJob = { name = 'police', minGrade = 1 }, -- job and min grade required to start a raid
    requiredItems = { -- items required to raid
        { item = 'phone', amount = 1, remove = true }
    },
}

Config.Security = {
    price = 50000,
    protectWorkers = true, -- if true, workers will not 'arrested' by the cops and hide until lab is back running again
    protectWorkersInventory = true, -- if true, workers inventory will not be able to be taken by cops during a raid
}

Config.StashGrades = {
    { -- DEFAULT GRADE
        price = 0,
        weight = 10000,
        slots = 10,
    },
    {
        price = 25000,
        weight = 25000,
        slots = 20,
    },
    {
        price = 50000,
        weight = 50000,
        slots = 30,
    }
}

Config.Blips = {
    ownedLab = { -- blip seen by the owner of the lab
        enabled = true,
        sprite = 473,
        color = 3,
        scale = 0.8,
        display = 4,
        shortrange = true,
        label = '%s', -- %s will be replaced with the lab name
    },
    unownedLab = { -- blip seen by everyone if the lab has no owner
        enabled = true,
        sprite = 473,
        color = 0,
        scale = 0.8,
        display = 4,
        shortrange = true,
        label = '%s ($%s)', -- 1st %s will be replaced with the lab name, 2nd %s will be replaced with the lab price
    },
}

Config.EntranceNPC = {
    model = "s_m_m_highsec_01",
    anims = {
        failPurchase = {
            dict = "misscommon@response",
            anim = "screw_you"
        },
        successPurchase = {
            dict = "mp_ped_interaction",
            anim = "handshake_guy_a",
        },
    },
    scenarios = {
        forSaleStanding = "WORLD_HUMAN_CLIPBOARD",
        ownedStanding = "WORLD_HUMAN_GUARD_STAND",
    }
}

--[[
    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

    IF IT CANT FIND A TARGET IT WILL WORK WITH 3D TEXT + OX_LIB CONTEXT MENU
--]]

-- FM = 'fmLib'
-- OXTarget = 'ox_target'
-- QBTarget = 'qb-target'
IgnoreResourceNotFoundErrors = false
IgnoreResourceInitializedLogs = false
--[[ 
    BY RX Scripts Š rxscripts.xyz

    FILE NAME DOES NOT MATTER

    YOU CAN CREATE THESE DRUGLABS IN-GAME BY USING /dl:create INGAME 
    type = 'map', works with coordinates (for MLO, YMAP, IPL's)
    type = 'shell', works with offsets, spawn shells by /shell:spawn shell_name, to get the offsets
--]]

Config.DrugLabs['rxs_cokelab'] = {
    type = 'shell', -- map or shell
    shell = 'rxs_cokelab',
    door = {
        offset = vector3(-2.553955, -6.854980, 1.000244),
        heading = 359.83413696289,
    },
    laptop = {
        offset = vector3(7.571106, -0.644775, 1.805929),
        heading = 180.260929107666,
    },
    stash = {
        offset = vector3(-2.459839, 6.073975, 1.000210),
    },
    actions = {
        ['Cut Coke'] = {
            offset = vector3(-0.208801, -1.310303, 1.834344),
            progressLabel = 'Cutting Coke..',
            duration = 10000, -- in ms
            animation = {
                dict = "mini@repair",
                anim = "fixing_a_player",
            },
            requiredItems = {
                { item = 'coca_leaf', label = 'Coke Leaf', amount = 20, remove = true, }
            },
            rewardItems = {
                { item = 'cocaine', label = 'Cocaine', amount = 5 }
            },
        },
        ['Pack Coke'] = {
            offset = vector3(0.196228, 1.286865, 1.834344),
            progressLabel = 'Packing Coke..',
            duration = 10000, -- in ms
            animation = {
                dict = "mini@repair",
                anim = "fixing_a_player",
            },
            requiredItems = {
                { item = 'cocaine', label = 'Cocaine', amount = 20, remove = true },
            },
            rewardItems = {
                { item = 'drug_white', label = 'Cocaine Block', amount = 1 }
            },
        },
    },
    workers = { -- Workers can be hired to do actions for you, they will work slower as they work 24/7. (They are tired, duhh..)
        ['Walter White'] = {
            model = 's_m_y_factory_01',
            offset = vector3(-3.894958, 4.415771, 1.000221),
            heading = 89.363540649414,
            action = 'Cut Coke', -- must match a valid action, the worker will do this action and needs the required items and gives the reward items of the action
            duration = 1, -- in minutes, how long will the worker take to complete the action one time
            onlineRequired = false, -- if true, the worker will only work when the lab owner is online
            hire = {
                price = 5000, -- per hour
                minHours = 24, -- min hours the worker must be hired at once, must be re-hired after this time
                maxHours = 72, -- max hours the worker can be hired at once, must be re-hired after this time
            }
        },
        ['Jesse Pinkman'] = {
            model = 's_m_y_factory_01',
            offset = vector3(-3.773499, 0.157715, 1.000221),
            heading = 88.450210571289,
            action = 'Pack Coke', -- must match a valid action, the worker will do this action and needs the required items and gives the reward items of the action
            duration = 1, -- in minutes, how long will the worker take to complete the action one time
            onlineRequired = false, -- if true, the worker will only work when the lab owner is online
            hire = {
                price = 5000, -- per hour
                minHours = 24, -- min hours the worker must be hired at once, must be re-hired after this time
                maxHours = 72, -- max hours the worker can be hired at once, must be re-hired after this time
            }
        },
    }
}

Opensource Files

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

---@return boolean | nil
function RaidMinigame(hasSecurity)
    TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_STAND_MOBILE", 0, true)
    local result
    
    -- You can use hasSecurity to check if the lab has security, to make the raid harder
    if hasSecurity then
        result = lib.skillCheck({'medium', 'medium', 'hard'}, {'w', 'a', 's', 'd'})
    else
        result = lib.skillCheck({'easy', 'easy', 'easy'}, {'w', 'a', 's', 'd'})
    end

    ClearPedTasks(playerPed)
    
    -- Must return: true, false or nil
    return result
end

function ShowMarker(type, coords)
    if type == 'laptop' or type == 'door' or type == 'stash' or type == 'action' then
        DrawMarker(2, coords, 0, 0, 0, 0, 180.0, 0, 0.3, 0.3, 0.3, 204, 0, 102, 100, false, false, 2, true, false, false, false)
    end
end

-- Only works with qb-target or ox_target started
function InitEntranceTarget(labId)
    local lab = Labs[labId]
    if not lab then return end

    if OXTarget then
        OXTarget:addLocalEntity(lab.ped, {
            {
                name = 'enter'..labId,
                label = 'Enter '..lab.name,
                icon = 'fas fa-sign-in-alt',
                distance = 2.5,
                canInteract = function()
                    return lab.owner and (lab.code or lab.lastraid)
                end,
                onSelect = function()
                    EnterLab(labId)
                end
            },
            {
                name = 'changecode'..labId,
                label = 'Set Code',
                icon = 'fas fa-key',
                distance = 2.5,
                canInteract = function()
                    return lab.owner and lab.owner == FM.player.getIdentifier()
                end,
                onSelect = function()
                    ChangeCode(labId)
                end
            },
            {
                name = 'buy'..labId,
                label = 'Buy '..lab.name..' ($'..lab.price..')',
                icon = 'fas fa-dollar-sign',
                distance = 2.5,
                canInteract = function()
                    return not lab.owner
                end,
                onSelect = function()
                    OpenBuyLabDialog(labId)
                end
            },
            {
                name = 'raid'..labId,
                label = 'Raid '..lab.name,
                icon = 'fas fa-handcuffs',
                distance = 2.5,
                canInteract = function()
                    return Config.CopsRaid.enabled and CurrentJob and CurrentJob.name == Config.CopsRaid.allowedJob.name and CurrentJob.grade >= Config.CopsRaid.allowedJob.minGrade and lab.owner
                end,
                onSelect = function()
                    RaidLab(labId)
                end
            }
        })
    elseif QBTarget then
        QBTarget:AddTargetEntity(lab.ped, {
            options = {
                {
                    label = 'Enter '..lab.name,
                    icon = 'fas fa-sign-in-alt',
                    targeticon = 'fas fa-sign-in-alt',
                    action = function()
                        EnterLab(labId)
                    end,
                    canInteract = function()
                        return lab.owner and (lab.code or lab.lastraid)
                    end,
                },
                {
                    label = 'Set Code',
                    icon = 'fas fa-key',
                    targeticon = 'fas fa-key',
                    action = function()
                        ChangeCode(labId)
                    end,
                    canInteract = function()
                        return lab.owner and lab.owner == FM.player.getIdentifier()
                    end,
                },
                {
                    label = 'Buy '..lab.name..' ($'..lab.price..')',
                    icon = 'fas fa-dollar-sign',
                    targeticon = 'fas fa-dollar-sign',
                    action = function()
                        OpenBuyLabDialog(labId)
                    end,
                    canInteract = function()
                        return not lab.owner
                    end,
                },
                {
                    label = 'Raid '..lab.name,
                    icon = 'fas fa-handcuffs',
                    targeticon = 'fas fa-handcuffs',
                    action = function()
                        RaidLab(labId)
                    end,
                    canInteract = function()
                        return Config.CopsRaid.enabled and CurrentJob and CurrentJob.name == Config.CopsRaid.allowedJob.name and CurrentJob.grade >= Config.CopsRaid.allowedJob.minGrade and lab.owner
                    end,
                }
            },
            distance = 2.5,
        })
    end
end

-- Gets used when ox_target and qb-target are not started
function OpenLabMenu(labId)
    local lab = Labs[labId]
    if not lab then return end

    local opts = {}
    
    if lab.owner and (lab.code or lab.lastraid) then
        opts[#opts+1] = {
            title = 'Enter '..lab.name,
            icon = 'fas fa-sign-in-alt',
            arrow = true,
            onSelect = function()
                EnterLab(labId)
            end,
        }
    end

    if lab.owner and lab.owner == FM.player.getIdentifier() then
        opts[#opts+1] = {
            title = 'Set Code',
            icon = 'fas fa-key',
            arrow = true,
            onSelect = function()
                ChangeCode(labId)
            end,
        }
    end

    if not lab.owner then
        opts[#opts+1] = {
            title = 'Buy '..lab.name..' ($'..lab.price..')',
            icon = 'fas fa-dollar-sign',
            arrow = true,
            onSelect = function()
                OpenBuyLabDialog(labId)
            end,
        }
    end

    if Config.CopsRaid.enabled and CurrentJob and CurrentJob.name == Config.CopsRaid.allowedJob.name and CurrentJob.grade >= Config.CopsRaid.allowedJob.minGrade and lab.owner then
        opts[#opts+1] = {
            title = 'Raid '..lab.name,
            icon = 'fas fa-handcuffs',
            arrow = true,
            onSelect = function()
                RaidLab(labId)
            end,
        }
    end

    lib.registerContext({
        id = 'labmenu'..tostring(labId),
        title = lab.name,
        options = opts,
    })

    lib.showContext('labmenu'..tostring(labId))
end
--[[
BY RX Scripts Š rxscripts.xyz
--]]

-- Custom can buy check function u can integrate custom checks
---@param playerId number Id/Source of the player
---@param lab table Lab object
---@return boolean, string? 
function CanBuyLab(playerId, lab)
    return true
    -- return false, 'You cannot buy this lab because of..'
end
PreviousOperation DLCNextExports

Last updated 9 months ago

🌐
📝