PoisonCode Docs
TebexDiscordYoutube
  • SCRIPTS
    • 💡pc_collections
      • ✨Features
      • 🖥️Installation & dependencies
      • 🛠️Exports & events
      • ⚙️Open files preview
      • 🔧Tutorials
      • 📥Updates
        • 🤔How to update
        • 🔌Version compatibility
    • 💎pc_organizations
      • ✨Features
      • 🖥️Installation & dependencies
      • 🛠️Exports & events
      • ⚙️Open files preview
      • 🔧Tutorials
      • 📥Updates
        • 🤔How to update
        • 🔌Version compatibility
    • 💡pc_skills
      • ✨Features
      • 🖥️Installation & dependencies
      • 🛠️Exports & events
      • ⚙️Open files preview
      • 🔧Tutorials
      • 📥Updates
        • 🤔How to update
    • 📦pc_airdrop
      • ✨Features
      • 🖥️Installation & dependencies
      • ⚙️Open files preview
      • 🔧Tutorials
      • 📥Updates
        • 🤔How to update
    • 💬pc_notifications
      • ✨Features
      • 🖥️Installation & dependencies
      • 🕹️Usage
Powered by GitBook
On this page
  • config/config.lua
  • config/translations.lua
  • client/utils.lua
  • server/utils.lua

Was this helpful?

  1. SCRIPTS
  2. pc_organizations

Open files preview

Config files preview, these files are ignored by the escrow system and can be modified.

This script is customizable, there is a total of 4 files accessible for you.

config/config.lua

Click here to see a preview config.lua
Config = {}
-- _____       _                  _____          _                                     _          _   _                    __   ___  
-- |  __ \    (_)                / ____|        | |                                   (_)        | | (_)                  /_ | / _ \ 
-- | |__) |__  _ ___  ___  _ __ | |     ___   __| | ___     ___  _ __ __ _  __ _ _ __  _ ______ _| |_ _  ___  _ __  ___    | || | | |
-- |  ___/ _ \| / __|/ _ \| '_ \| |    / _ \ / _` |/ _ \   / _ \| '__/ _` |/ _` | '_ \| |_  / _` | __| |/ _ \| '_ \/ __|   | || | | |
-- | |  | (_) | \__ \ (_) | | | | |___| (_) | (_| |  __/  | (_) | | | (_| | (_| | | | | |/ / (_| | |_| | (_) | | | \__ \   | || |_| |
-- |_|   \___/|_|___/\___/|_| |_|\_____\___/ \__,_|\___|   \___/|_|  \__, |\__,_|_| |_|_/___\__,_|\__|_|\___/|_| |_|___/   |_(_)___/ 
--                                                                    __/ |                                                          
--                                                                   |___/                                                                                                    
-- © PoisonCode 
-- Discord: https://discord.gg/rNJ8cHXCsN
-- Tebex: https://poisoncode.tebex.io

--   __  __       _                          __ _       
--  |  \/  |     (_)                        / _(_)      
--  | \  / | __ _ _ _ __     ___ ___  _ __ | |_ _  __ _ 
--  | |\/| |/ _` | | '_ \   / __/ _ \| '_ \|  _| |/ _` |
--  | |  | | (_| | | | | | | (_| (_) | | | | | | | (_| |
--  |_|  |_|\__,_|_|_| |_|  \___\___/|_| |_|_| |_|\__, |
--                                                 __/ |
--                                                |___/ 

Config.clientDebug = false -- Enables additional debug messages on the client side console (F8), we recommend turning this off while not debugging
Config.serverDebug = true -- Enables additional debug messages on the server side console, you can keep it on if these messages don't bother you
-- *Error and security messages will be print anyway*

Config.integrations = {
    -- Mandatory
    ox_inventory = GetResourceState('ox_inventory') == 'started' or false,
    -- Optional
    pc_notifications = GetResourceState('pc_notifications') == 'started' or false,
    pc_skills = GetResourceState('pc_skills') == 'started' or false,
}

-- Here you can turn on or off specific modules, we recommend keeping them all on for best experience
Config.modules = {
    zones = true, -- enables zones module
    drugwars = true, -- enables drugwars module
}

-- Here you can choose which options should be available in ox_target
-- You can still control the access to these options with permissions in Config.Permissions
Config.target = {
    tablet = true, -- enables opening the tablet with ox_target
    safeCheck = true, -- enables checking the organization's safe with ox_target
    safeDeposit = true, -- enables depositing and withdrawing money from the organization's safe with ox_target
    safeWithdraw = true, -- enables withdrawing money from the organization's safe with ox_target
    warehouse = true, -- enables opening the warehouse with ox_target
    wardrobe = true, -- enables opening the wardrobe with ox_target
    wardrobeAdd = true, -- enables adding outfits to the wardrobe with ox_target
    wardrobeRemove = true, -- enables removing an outfit from the wardrobe with ox_target
}

-- Default values all organizations start with
Config.defaultValues = {
    ["membersCount"] = 7, -- example: each organization starts with max. 7 members (In slots)
    ["warehouseSlots"] = 1, -- (In slots (ox_inventory))
    ["warehouseWeight"] = 500, -- (In kg (ox_inventory))
    ["drugwarsTax"] = 10, -- (In % of sale)
}

-- Price for each upgrade
Config.upgradesPrice = {
    ["membersCount"] = 50000, -- example: 1 upgrade = 50000$ from organization's safe
    ["warehouseSlots"] = 25000,
    ["warehouseWeight"] = 15000,
    ["drugwarsTax"] = 50000,
}

-- How much each upgrade adds
Config.upgradesIncrements = {
    ["membersCount"] = 1, -- example: 1 upgrade = 1 additional member slot
    ["warehouseSlots"] = 1,
    ["warehouseWeight"] = 5,
    ["drugwarsTax"] = 1,
}

-- Max values for each upgrade
Config.upgradesMaxValues = {
    ["membersCount"] = 20, -- example: maximum 20 members in each organization
    ["warehouseSlots"] = 200,
    ["warehouseWeight"] = 500000,
    ["drugwarsTax"] = 20,
}

-- Feel free to change permission LABEL. Changing permission NAME WILL BREAK THE SCRIPT.
Config.Permissions = {
    {name = "permissionsManage", label = "managing permissions"},
    {name = "hireMembers", label = "recruiting members"},
    {name = "fireMember", label = "firing members"},
    {name = "upgrades", label = "managing upgrades"},
    {name = "noteAdd", label = "adding notes"},
    {name = "noteRemove", label = "removing notes"},
    {name = "safe", label = "safe access"},
    {name = "warehouse", label = "warehouse access"},
    {name = "wardrobeOpen", label = "wardrobe access "},
    {name = "wardrobeAdd", label = "adding outfits"},
    {name = "wardrobeRemove", label = "removing outfits"},
    {name = "webhookModify", label = "webhook changes"}
}

-- You can configure organizations here:
Config.Organizations = {
    ["families"] = {
        label = "Families",
        Blip = vec3(-157.0381, -1616.7047, 32.6994),
        Safe = {
            coords = vector3(-163.93, -1619.61, 33.85),
            size = vector3(0.6, 0.6, 0.6),
            rotation = 340.0
        },
        Storage = {
            coords = vector3(-158.96, -1608.36, 33.65),
            size = vector3(2.2, 0.6, 2.0),
            rotation = 340.0
        },
        Wardrobe = {
            coords = vector3(-162.9, -1613.6, 33.65),
            size = vector3(2.8, 0.6, 2.0),
            rotation = 340.0
        }
    },
    ["lost"] = {
        label = "Lost",
        Blip = vec3(974.3788, -119.4971, 73.3864),
        Safe = {
            coords = vector3(977.59, -104.65, 74.65),
            size = vector3(1.0, 0.8, 1.2),
            rotation = 310.0
        },
        Storage = {
            coords = vector3(987.35, -93.43, 74.85),
            size = vector3(0.8, 2.2, 2.0),
            rotation = 315.0
        },
        Wardrobe = {
            coords = vector3(972.17, -97.62, 74.87),
            size = vector3(0.4, 3.8, 2.0),
            rotation = 310.0
        }
    },
    ["marabunta"] = {
        label = "Marabunta",
        Blip = vec3(1258.1376, -1570.7284, 57.4016),
        Safe = {
            coords = vector3(1251.25, -1580.72, 58.55),
            size = vector3(0.6, 0.6, 0.6),
            rotation = 305.0
        },
        Storage = {
            coords = vector3(1254.59, -1572.07, 58.75),
            size = vector3(1, 2.6, 2.0),
            rotation = 305.0
        },
        Wardrobe = {
            coords = vector3(1254.62, -1576.37, 58.15),
            size = vector3(0.6, 1.4, 1.0),
            rotation = 305.0
        }
    },
    ["cartel"] = {
        label = "De La Cosa",
        Blip = vec3(1403.78, 1144.02, 114.33),
        Safe = {
            coords = vector3(1394.74, 1150.37, 115.33),
            size = vector3(0.8, 1.6, 2),
            rotation = 0.0
        },
        Storage = {
            coords = vector3(1403.78, 1144.02, 114.33),
            size = vector3(0.6, 3.0, 2.0),
            rotation = 0.0
        },
        Wardrobe = {
            coords = vector3(1400.4, 1139.73, 114.33),
            size = vector3(1.4, 0.6, 2.2),
            rotation = 0.0
        }
    },
    ["mafia"] = {
        label = "La Cosa Nostra",
        Blip = vec3(1096.7808, -3099.2991, -39.0000),
        Safe = {
            coords = vector3(1087.7452, -3101.2766, -38.9614),
            size = vector3(1.0, 1.6, 1),
            rotation = 310.0
        },
        Storage = {
            coords = vector3(1100.9728, -3102.2998, -39.0000),
            size = vector3(0.6, 1.4, 2.0),
            rotation = 40.0
        },
        Wardrobe = {
            coords = vector3(1104.0432, -3102.3225, -39.0000),
            size = vector3(0.8, 3.4, 2.2),
            rotation = 40.0
        }
    },
    ["sinister"] = {
        label = "The Sinister",
        Blip = vector3(568.26, -2780.87, 6.09),
        Safe = {
            coords = vector3(519.56, -2757.89, 6.64),
            size = vector3(2.6, 1, 1),
            rotation = 330.0
        },
        Storage = {
            coords = vector3(506.36, -2756.69, 3.07),
            size = vector3(4.0, 1, 2.0),
            rotation = 330.0
        },
        Wardrobe = {
            coords = vector3(568.26, -2780.87, 6.09),
            size = vector3(3.0, 1, 2.2),
            rotation = 330.0
        }
    },
}


--   ______                                        __ _       
--  |___  /                                       / _(_)      
--     / / ___  _ __   ___  ___    ___ ___  _ __ | |_ _  __ _ 
--    / / / _ \| '_ \ / _ \/ __|  / __/ _ \| '_ \|  _| |/ _` |
--   / /_| (_) | | | |  __/\__ \ | (_| (_) | | | | | | | (_| |
--  /_____\___/|_| |_|\___||___/  \___\___/|_| |_|_| |_|\__, |
--                                                       __/ |
--                                                      |___/ 


Config.zoneSettings = {
    auto = true,
    autoStart = 1200, --- (seconds) How quickly the first zone after restarting the script/server appear
    autoDelay = 1800, --- (seconds) How quickly the next zone appears (the timer starts right after the previous zone is created)

    zoneCaptureTime = 20, --- (seconds) How long it takes to capture the zone
    zoneDuration = 600, --- (seconds) How long the zone is active 
    zoneCaptureDelay = 20, --- How quickly can you capture the zone after canceling the capture (seconds)
    zonePrepareTime = 20, --- (seconds) How long it takes to prepare the zone before it appears
    zoneSize = 150.0,
    captureSize = 6.0,
}


-- Possible loot tables for zone rewards, only one table will be chosen, at random
-- When using minCount and maxCount, it will pick a random number in that range
-- When using count, it will always use that number
Config.zoneRewards = {
    { 
        {item = 'meth', minCount = 3, maxCount = 20},
        {item = 'weed', minCount = 8, maxCount = 25},
    },
-- OR
    { 
        {item = 'black_money', minCount = 5000, maxCount = 25000},
    },
-- OR
    { 
        {item = 'WEAPON_MACHETE', minCount = 1, maxCount = 2},
        {item = 'WEAPON_KNIFE', minCount = 1, maxCount = 2},  
    },
-- OR
    { 
        {item = 'WEAPON_SNSPISTOL', count = 1},
    }
}


Config.zoneLocations = {
    {
        coords = vector3(-2527.5723, 2699.8335, -22.838), -- Center of the zone
        propCoords = { -- Crate location, only one of the values below will be choosen (at random).
            vector3(-2527.5723, 2699.8335, 1.838), 
            vector3(-2522.7871, 2733.1943, 1.8316),
            vector3(-2475.4683, 2731.6782, 1.8716),    
        }
    },

    {
        coords = vector3(383.3146, 2893.9709, -20.5480), -- Center of the zone
        propCoords = { -- Crate location, only one of the values below will be choosen (at random).
            vector3(398.6463, 2980.2148, 39.9499), 
            vector3(268.5528, 2867.1343, 73.1748),
            vector3(319.3150, 2884.2703, 48.0229),      
        }
    },

    {
        coords = vector3(1075.9691, 2366.7412, -18.2522), -- Center of the zone
        propCoords = { -- Crate location, only one of the values below will be choosen (at random).
            vector3(1089.4799, 2309.3499, 44.5132), 
            vector3(1006.8578, 2360.2310, 54.5715),
            vector3(1026.1266, 2440.3679, 43.9705),  
        }
    },

    {
        coords = vector3(1500.9552, 3549.1238, 35.6549), -- Center of the zone
        propCoords = { -- Crate location, only one of the values below will be choosen (at random).
            vector3(1516.6475, 3577.0632, 41.8550), 
            vector3(1559.3889, 3522.0605, 35.0679),
            vector3(1594.8564, 3586.1721, 38.0666),  
        }
    },

    {
        coords = vector3(978.2614, -3136.7349, -20.9008), -- Center of the zone
        propCoords = { -- Crate location, only one of the values below will be choosen (at random).
            vector3(930.9222, -3097.9087, 16.1479), 
            vector3(1029.9514, -3131.3235, 4.9008),
            vector3(959.0121, -3097.4951, 4.9008),  
        }
    }
}


-- _____                                                               __ _       
-- |  __ \                                                             / _(_)      
-- | |  | |_ __ _   _  __ _  __      ____ _ _ __ ___    ___ ___  _ __ | |_ _  __ _ 
-- | |  | | '__| | | |/ _` | \ \ /\ / / _` | '__/ __|  / __/ _ \| '_ \|  _| |/ _` |
-- | |__| | |  | |_| | (_| |  \ V  V / (_| | |  \__ \ | (_| (_) | | | | | | | (_| |
-- |_____/|_|   \__,_|\__, |   \_/\_/ \__,_|_|  |___/  \___\___/|_| |_|_| |_|\__, |
--                     __/ |                                                  __/ |
--                    |___/                                                  |___/ 
Config.warsSettings = {
    auto = true, -- should the war be started automatically
    autoStart = 1200, --- (seconds) How quickly the first war appears (after restart/start)
    autoDelay = 10800, --- (seconds) How quickly the next war appears (the timer starts right after the previous war is *created*)
    warDuration = 1800, --- (seconds) How long the war is active
}

Config.baseSellChance = 40 -- (in %) Base chance to sell drugs, without skill multiplier

-- Used only when using pc_skills resource
Config.pc_skills = {
    skillName = "skill4", -- which skill is used for drug selling
    saleXP = 10, -- how much xp you gain for each sold drug (for each piece)
    copTipoffLvl = 5, -- when player reaches this level, he will recieve tip-off if the client called cops
    lvlBonus = 1, -- how much higher is the chance to sell drugs, for each level (in %), for example each lvl = 1% added to baseSellChance
}

Config.moneyType = "black_money" -- type of money that should be given to player selling ("money" or "black_money")

Config.copsRequired = 2 -- How many cops are required to sell the drugs
Config.copsJobs = {'police', 'sheriff'} -- jobs that are counted as cops
-- example: if you have copsRequired = 2, and police and sheriff jobs are counted as cops, if there's 1 police and 1 sheriff on duty, you will be able to sell drugs

Config.blacklistedJobs = {'police', 'sheriff'} -- jobs that are blacklisted from selling drugs

-- Drugs that can be sold to npcs
-- min and max are min and max price the player will recieve
Config.Drugs = {
    ['acid'] = {min = 182, max = 444},
    ['lsd'] = {min = 145, max = 388},
    ['meth'] = {min = 113, max = 338},
    ['coke'] = {min = 125, max = 292},
    ['weed'] = {min = 148, max = 182},
}

-- Informants are only available for organization that captured a zone. When bought, they will check if there's a police officer in the zone,
-- after that they'll notify organization members when a police officer enters the zone.
Config.enableAlertNpcs = true -- Should informants be available

-- zone -- zone in which this infromant is active
-- model -- model of the npc
-- coords -- coords of the npc
-- price -- price for activating the informant
-- duration (seconds) -- how long the informant will be active
-- delay (seconds) -- delay before the informant will alert
Config.alertNpc = {
    -- zone 1
    {zone = 'zone1', model = 'a_m_m_mexlabor_01', coords = vector4(-357.7109, -640.9236, 30.7715, 207.9297), price = 2500, duration = 100, delay = 20},
    {zone = 'zone1', model = 'a_m_m_mexlabor_01', coords = vector4(-1215.3136, -569.2302, 26.3067, 163.3186), price = 5000, duration = 200, delay = 10},

    -- zone 2
    {zone = 'zone2', model = 'a_m_m_mexlabor_01', coords = vector4(963.3970, -944.5385, 41.6625, 270.3664), price = 2500, duration = 100, delay = 20},
    {zone = 'zone2', model = 'a_m_m_mexlabor_01', coords = vector4(729.7922, -992.6858, 22.9715, 3.9504), price = 5000, duration = 200, delay = 10},

    -- zone 3 
    {zone = 'zone3', model = 'a_m_m_mexlabor_01', coords = vector4(748.8958, -1692.4928, 28.3219, 167.1573), price = 2500, duration = 100, delay = 20},
    {zone = 'zone3', model = 'a_m_m_mexlabor_01', coords = vector4(433.7659, -1879.3448, 25.9994, 95.7669), price = 5000, duration = 200, delay = 10},

    -- zone 4
    {zone = 'zone4', model = 'a_m_m_mexlabor_01', coords = vector4(-394.7887, -1881.1279, 19.5278, 346.9869), price = 2500, duration = 100, delay = 20},
    {zone = 'zone4', model = 'a_m_m_mexlabor_01', coords = vector4(-532.8264, -1781.5658, 20.5106, 292.3524), price = 5000, duration = 200, delay = 10},
}

-- List of peds that can't buy drugs from the player
-- You can expand this list if you want
Config.pedBlacklist = {
    "u_f_m_casinocash_01",
    "csb_trafficwarden",
    "u_m_y_burgerdrug_01",
    "u_m_y_tattoo_01",
    "s_m_m_gardener_01",
    "s_m_y_xmech_01",
    "s_m_m_lathandy_01",
    "a_m_y_bevhills_01",
    "a_m_m_indian_01",
    "u_f_y_danceburl_01",
    "ig_andreas",
    "mp_m_shopkeep_01",
    "a_m_y_epsilon_01",
    "a_f_y_topless_01",
    "cs_paper",
    "u_m_m_jewelsec_01",
    "a_m_m_business_01",
    "a_m_y_business_02",
    "s_m_m_autoshop_01",
    "s_m_m_doctor_01",
    "mp_m_g_vagfun_01",
    "s_m_m_pilot_01",
    "a_c_cow",
    "a_c_boar",
    "a_c_cat_01",
    "a_c_chickenhawk",
    "a_c_chimp",
    "a_c_chop",
    "a_c_crow",
    "a_c_deer",
    "a_c_husky",
    "a_c_mtlion",
    "a_c_pig",
    "a_c_pigeon",
    "a_c_poodle",
    "ig_trafficwarden",
    "a_f_y_business_01",
    "cs_siemonyetarian",
    "u_m_y_chip",
    "s_f_m_fembarber",
    "mp_m_weapexp_01",
    "a_c_pug",
    "a_c_rabbit_01",
    "a_c_rat",
    "a_c_retriever",
    "a_c_rhesus",
    "a_c_rottweiler",
    "a_c_seagull",
    "a_c_shepherd",
    "a_f_y_business_02",
    "a_c_westy",
}

config/translations.lua

Click here to see a preview translations.lua
-- _____                          _____          _      
-- |  __ \    (_)                / ____|        | |     
-- | |__) |__  _ ___  ___  _ __ | |     ___   __| | ___ 
-- |  ___/ _ \| / __|/ _ \| '_ \| |    / _ \ / _` |/ _ \
-- | |  | (_) | \__ \ (_) | | | | |___| (_) | (_| |  __/
-- |_|   \___/|_|___/\___/|_| |_|\_____\___/ \__,_|\___|
-- © PoisonCode 
-- Discord: https://discord.gg/rNJ8cHXCsN
-- Tebex: https://poisoncode.tebex.io

Translations = {
    -- General
    organization = "Organization",
    balanceCheck = "Check balance",
    deposit = "Deposit cash",
    withdraw = "Withdraw cash",
    openStorage = "Open storage",
    savedOutfits = "Saved outfits",
    orgOutfits = "Organization outfits",
    addOutfit = "Add organization outfit",
    outfitName = "Outfit name",
    outfitNameDesc = "Provide a name for the outfit",
    removeOutfit = "Remove organization outfit",
    hideout = "Organization hideout",
    noOutfits = "No organization outfits saved",
    wardrobe = "Wardrobe",
    setName = "Set a name",
    outfitAdded = "Outfit added",
    outfitRemoved = "Outfit removed",
    safe = "Safe",
    depositMoney = "Deposit cash",
    depositMoneyDesc = "How much cash do you want to deposit?",
    withdrawMoney = "Withdraw cash",
    withdrawMoneyDesc = "How much cash do you want to withdraw?",
    safeMoney = "There is %s $ in the safe",
    notEnoughMoney = "You don't have enough cash",
    depositSuccess = "Cash deposited, there is now %s $ in the safe",
    notEnoughMoneySafe = "There is not enough cash in the safe",
    withdrawSuccess = "Cash withdrawn, there is now %s $ in the safe",
    notEnoughSlots = "Maximum members reached",
    maxUpgrade = "Maximum upgrade reached",
    upgradeBought = "Upgrade bought",
    noteAdded = "Note added",
    webhookModified = "Webhook modified",
    itemSwaped = "Item swaped",
    itemOut = "Item taken",
    itemIn = "Item put",
    openTablet = "Open tablet",


    -- Logs
    logOutfitAdded = "%s %s added an outfit named: %s",
    logOutfitRemoved = "%s %s removed an outfit named: %s",
    logSafeDeposit = "%s %s deposited %s $ into the safe",
    logSafeWithdraw = "%s %s withdrew %s $ from the safe",
    logMemberFired = "%s %s fired %s %s",
    logMemberHired = "%s %s hired %s %s",
    logUpgradeBought = "%s %s upgraded %s by %s",
    logNoteAdded = "%s %s added a note",
    logNoteRemoved = "%s %s removed a note",
    logWebhookModified = "%s %s modified the organization webhook",
    logItemOut = "Took",
    logItemIn = "Put",

    logZoneCreated = "Zone created",
    logZoneCreatedDesc = "A new zone has been created. \nType:%s\nLocation:%s\nBox:%s",
    logZoneReward = "Zone captured",
    logZoneRewardDesc = "A zone has been captured by %s.\nRewards: `%s`",

    logDrugsSold = "Drugs sold",
    logDrugsSoldDesc = "Player %s sold: %s x %s for %s$",

    logDrugwarsTax = "Drug sale tax",
    logDrugwarsTaxDesc = "Organization received drug sale tax of %s$",


    -- HTML (Tablet)
    permissions = "Permissions",
    save = "Save",
    cancel = "Cancel",
    noPeopleNerby = "No people nearby",
    warEndsIn = "Drug war ends in",
    warStartIn = "Drug war starts in",
    noWar = "There is no drug war",
    remove = "Remove",
    fireMember = "Fire",
    home = "Home",
    members = "Members",
    upgrades = "Upgrades",
    drugWars = "Drug wars",
    logs = "Logs",
    close = "Close",
    info = "Info",
    orgName = "name",
    finances = "Finances",
    moneyOwned = "Cash",
    notes = "Notes",
    newNote = "New note",
    noteAddTitle = "adding a note",
    confirm = "Confirm",
    hire = "Recruit",
    name = "Name",
    actions = "Actions",
    drug = "Drug",
    map = "City map",
    leaderboard = "Leaderboard",
    maxMembers = "Max members count",
    maxMembersDesc = "Increase maximum members amount",
    slot = "Slot",
    price = "Price",
    buy = "Buy",
    warehouseSlots = "Warehouse slots",
    warehouseSlotsDesc = "Increase warehouse slots amount",
    warehouseWeight = "Warehouse weight",
    warehouseWeightDesc = "Increase maximum warehouse weight",
    kg = "Kg",
    drugwarsTax = "Drugwars tax",
    drugwarsTaxDesc = "Increase the amount you get from sold drugs",
    percent = "%",
    webhook = "Webhook",
    date = "Date",
    webhookLink = "Provide a webhook link",
    membersOnline = "Members online",


    -- Zones
    zone = "Zone",
    fists = "[Fists]",
    melee = "[Melee]",
    guns = "[Guns]",
    collect = "Collect chest",
    newZoneIn = "A new zone will appear in %s seconds.",
    newZoneStart = "A new zone appeared!",
    vehicleEnter = "You can't enter the zone in a vehicle!",
    wrongWeapon = "You can't use this weapon in this zone type!",
    inVehicle = "You can't do this while in a vehicle!",
    zoneBusy = "Someone else is already capturing this zone!",
    cooldown = "You have to wait %s seconds before you can capture this zone again!",
    captureStart = "You started capturing the zone!",
    captureCancelTooFar = "Zone capture canceled. You moved too far!",
    captureCancelDamage = "Zone capture canceled. You took damage!",
    captureSuccess = "You captured the zone!",


    -- Drug wars
    trySellDrugs = "Sell drugs",
    drugDealingTitle = "Drug dealing",
    drugDealingNoItems = "You don't have any items to sell",
    drugDealingNotEnough = "You don't have enough items to sell",
    drugDealingNotEnoughCops = "Not enough cops on duty. Required at least %s",
    drugDealingFailed = "Client refused to buy the drugs",
    drugDealingFailedPolice = "Client refused to buy the drugs and called the police",
    drugDealingBlacklistedJob = "You can't sell drugs",
    drugDealingXP = "You recieved %s XP points",
    drugDealingTaxPaid = "You sold drugs in zone controlled by %s. Tax paid: %s$",

    informantBuyTitle = "Buy informant",
    informantBuyText = "Do you want to buy an informant for %s$ ? \n You will receive a message when the police enters the zone.",
    informantTitle = "Informant",
    informantWar = "There is an active war in this zone",
    infromantMoney = "You don't have enough cash",
    informantOrg = "This zone doesn't belong to your organization",
    informantActive = "There is already an active informant in this zone",
    informantBought = "Informant bought!",
    informantEnd = "Informant services ended!",
    informantPoliceEnter = "Cops entered the zone, be careful!",
    informantPolicePresent = "There are cops in the zone!",
}

client/utils.lua

Click here to see a preview translations.lua
-- _____                          _____          _      
-- |  __ \    (_)                / ____|        | |     
-- | |__) |__  _ ___  ___  _ __ | |     ___   __| | ___ 
-- |  ___/ _ \| / __|/ _ \| '_ \| |    / _ \ / _` |/ _ \
-- | |  | (_) | \__ \ (_) | | | | |___| (_) | (_| |  __/
-- |_|   \___/|_|___/\___/|_| |_|\_____\___/ \__,_|\___|
-- © PoisonCode 
-- Discord: https://discord.gg/rNJ8cHXCsN
-- Tebex: https://poisoncode.tebex.io

-------------------------------------------------------------------------------------------------------------------
--- GENERAL
-------------------------------------------------------------------------------------------------------------------

function sendNotification(title, text, time, type)
    if Config.integrations.pc_notifications then
        exports['pc_notifications']:Notify(type, title, text, time, true)
    else
        
    end
end

-------------------------------------------------------------------------------------------------------------------
--- DRUGWARS
-------------------------------------------------------------------------------------------------------------------
local alertBlips = {}
RegisterNetEvent('pc_organizations:client:drugwars.alertCops', function(location)

    sendNotification("Drug dealing", "Drug deal in progress! Location pinged on map.", 10000, "info")

    local newBlip = AddBlipForCoord(location)
    SetBlipSprite(newBlip, 3)
    SetBlipDisplay(newBlip, 4)
    SetBlipScale(newBlip, 0.9)
    SetBlipAsShortRange(newBlip, true)
    BeginTextCommandSetBlipName('STRING')
    AddTextComponentString("Drug deal in progress!") 
    EndTextCommandSetBlipName(newBlip)

    table.insert(alertBlips, newBlip)

    SetTimeout(60000, function()
        if #alertBlips > 0 then
            RemoveBlip(alertBlips[1])
            table.remove(alertBlips, 1)
        end
    end)
end)

server/utils.lua

Click here to see a preview translations.lua
-- _____                          _____          _      
-- |  __ \    (_)                / ____|        | |     
-- | |__) |__  _ ___  ___  _ __ | |     ___   __| | ___ 
-- |  ___/ _ \| / __|/ _ \| '_ \| |    / _ \ / _` |/ _ \
-- | |  | (_) | \__ \ (_) | | | | |___| (_) | (_| |  __/
-- |_|   \___/|_|___/\___/|_| |_|\_____\___/ \__,_|\___|
-- © PoisonCode 
-- Discord: https://discord.gg/rNJ8cHXCsN
-- Tebex: https://poisoncode.tebex.io
-------------------------------------------------------------------------------------------------------------------
--- MAIN
-------------------------------------------------------------------------------------------------------------------
-- Function responsible for sending client notification
function sendClientNotification(id, title, text, time, type)
    if Config.integrations.pc_notifications then
        TriggerClientEvent('pc_notifications:Notify', id, type, title, text, time, true)
    else

    end
end

-------------------------------------------------------------------------------------------------------------------
--- COMMANDS
-------------------------------------------------------------------------------------------------------------------
-- Command for adding player to an organization will all permissions
ESX.RegisterCommand('setorg', {'admin'}, function(xPlayer, args, showError)
    if args.job == "unemployed" or Config.Organizations[args.job] then
        local permissions = {}
        for i = 1, #(Config.Permissions) do
            permissions[Config.Permissions[i].name] = true
        end

        args.playerId.set("org", {name = args.job, permissions = permissions})
        TriggerClientEvent('pc_organizations:client:main.setOrg', args.playerId.source, {name = args.job, permissions = permissions})
        MySQL.prepare('UPDATE `users` SET `org` = ?, `org_permissions` = ? WHERE `identifier` = ?', {args.job, json.encode(permissions), args.playerId.identifier})
    end
end, true, {help = ('Add player to organization (with all permissions!)'), validate = true, arguments = {
    {name = 'playerId', help = ('Player ID'), type = 'player'},
    {name = 'job', help = ('Organization name or "unemployed" to remove'), type = 'string'}
}})

-- A command for resetting an organization, all members will be removed, inventory will be cleared and upgrades will be reset
ESX.RegisterCommand('resetorg', {'admin'}, function(xPlayer, args, showError)
    local orgName = args.orgName
    local xPlayers = ESX.GetExtendedPlayers()
    
    for i = 1, #(xPlayers) do
        local xPlayer = xPlayers[i]
        if xPlayer.get("org").name == orgName then
            xPlayer.set("org", {name = "unemployed", permissions = {}})
            TriggerClientEvent('pc_organizations:client:main.setOrg', xPlayer.source, {name = "unemployed", permissions = {}})
        end
    end
    
    exports.ox_inventory:ClearInventory(orgName)
    exports.ox_inventory:SetSlotCount(orgName, Config.defaultValues.warehouseSlots)
    exports.ox_inventory:SetMaxWeight(orgName, Config.defaultValues.warehouseWeight)

    Organizations[orgName] = {account = 0, members_limit = Config.defaultValues.membersCount, warehouse_slots = Config.defaultValues.warehouseSlots, warehouse_weight = Config.defaultValues.warehouseWeight, drugwars_tax = Config.defaultValues.drugwarsTax} 
    
    MySQL.prepare('UPDATE `users` SET `org` = ?, `org_permissions` = ? WHERE `org` = ?', {"unemployed", json.encode({}), orgName})
    MySQL.prepare('UPDATE `organizations` SET `account` = 0, `members_limit` = ?, `warehouse_slots` = ?, `warehouse_weight` = ?, `drugwars_tax` = ? WHERE `name` = ?', {Config.defaultValues.membersCount, Config.defaultValues.warehouseSlots, Config.defaultValues.warehouseWeight, Config.defaultValues.drugwarsTax, orgName})
    MySQL.query.await('DELETE FROM `organizations_clothes` WHERE `org` = ?', {orgName})
    MySQL.query.await('DELETE FROM `organizations_logs` WHERE `org` = ?', {orgName})
    MySQL.query.await('DELETE FROM `organizations_notes` WHERE `org` = ?', {orgName})

end, true, {help = ('Reset organization to default'), validate = true, arguments = {
    {name = 'orgName', help = ('Organization name'), type = 'string'}
}})

ESX.RegisterCommand('orgmenu', {'user'}, function(xPlayer, args, showError)
    if exports["pc_organizations"]:hasOrgJob(xPlayer.source) then
        TriggerClientEvent("pc_organizations:OpenTablet", xPlayer.source)
    end
end, true, {help = ('Opens organizations tablet')})
-------------------------------------------------------------------------------------------------------------------
--- WEBHOOKS
-------------------------------------------------------------------------------------------------------------------
local adminWebhook = ""
local zonesWebhook = ""
local drugwarsWebhook = ""

-- These functions are responsible for sending the admin webhook
-- All organizations's actions will be posted to these webhooks for mods/admins
function sendAdminWebhook(org, title, content)
    local content = json.encode({
        avatar_url = "https://github.com/PoisonCodeDEV/images/blob/main/logoneon3.png?raw=true",
        username = "PoisonCode organizations ADMIN",  
        embeds = {{
            ["title"] = org.." - "..title,
            ["color"] = 248250,
            ["fields"] = {
                {
                    ["name"] = " ",
                    ["value"] = content,
                    ["inline"] = false
                },
            },
            ["footer"] = {
                ["text"] = org.." @ pc_organizations • "..os.date("%H:%M  %d/%m/%Y"),
                ["icon_url"] = "https://github.com/PoisonCodeDEV/images/blob/main/logoneon3.png?raw=true",
            },
        }},
    })

    PerformHttpRequest(adminWebhook, function(err, text, headers) end, 'POST', content, { ['Content-Type'] = 'application/json' })
end

function sendZonesWebhook(title, content)
    local content = json.encode({
        avatar_url = "https://github.com/PoisonCodeDEV/images/blob/main/logoneon3.png?raw=true",
        username = "PoisonCode organizations ZONES",  
        embeds = {{
            ["title"] = title,
            ["color"] = 248250,
            ["fields"] = {
                {
                    ["name"] = " ",
                    ["value"] = content,
                    ["inline"] = false
                },
            },
            ["footer"] = {
                ["text"] = "pc_organizations zones • "..os.date("%H:%M  %d/%m/%Y"),
                ["icon_url"] = "https://github.com/PoisonCodeDEV/images/blob/main/logoneon3.png?raw=true",
            },
        }},
    })

    PerformHttpRequest(zonesWebhook, function(err, text, headers) end, 'POST', content, { ['Content-Type'] = 'application/json' })
end

function sendDrugwarsWebhook(title, content)
    local content = json.encode({
        avatar_url = "https://github.com/PoisonCodeDEV/images/blob/main/logoneon3.png?raw=true",
        username = "PoisonCode organizations DRUGWARS",  
        embeds = {{
            ["title"] = title,
            ["color"] = 248250,
            ["fields"] = {
                {
                    ["name"] = " ",
                    ["value"] = content,
                    ["inline"] = false
                },
            },
            ["footer"] = {
                ["text"] = "pc_organizations drugwars • "..os.date("%H:%M  %d/%m/%Y"),
                ["icon_url"] = "https://github.com/PoisonCodeDEV/images/blob/main/logoneon3.png?raw=true",
            },
        }},
    })

    PerformHttpRequest(drugwarsWebhook, function(err, text, headers) end, 'POST', content, { ['Content-Type'] = 'application/json' })
end

-- This function is reposponsible for sending the organization's "private" webhook
-- Only this specific organization's actions will be posted
-- Organization A won't be able to see Organization B's actions
function sendOrgWebhook(org, webhook, title, content)
    local content = json.encode({
        avatar_url = "https://github.com/PoisonCodeDEV/images/blob/main/logoneon3.png?raw=true",
        username = "PoisonCode organizations",  
        embeds = {{
            ["title"] = title,
            ["color"] = 248250,
            ["fields"] = {
                {
                    ["name"] = " ",
                    ["value"] = content,
                    ["inline"] = false
                },
            },
            ["footer"] = {
                ["text"] = org.." @ pc_organizations • "..os.date("%H:%M  %d/%m/%Y"),
                ["icon_url"] = "https://github.com/PoisonCodeDEV/images/blob/main/logoneon3.png?raw=true",
            },
        }},
    })

    PerformHttpRequest(webhook, function(err, text, headers) end, 'POST', content, { ['Content-Type'] = 'application/json' })
end
-------------------------------------------------------------------------------------------------------------------
--- ZONES
-------------------------------------------------------------------------------------------------------------------
-- Function responsible for adding items to the player after capturing the zone
function addItem(xPlayer)
    local items = {}

    for i, itemData in ipairs(Config.zoneRewards[math.random(#Config.zoneRewards)]) do
        local count = nil

        if itemData.count then 
            count = itemData.count 
        else 
            count = math.random(itemData.minCount, itemData.maxCount) 
        end

        table.insert(items, {item = itemData.item, count = count})

        xPlayer.addInventoryItem(itemData.item, count)
    end

    return items
end

If you encounter any problems during configuration, you can create a support ticket on our discord.

PreviousExports & eventsNextTutorials

Last updated 4 months ago

Was this helpful?

💎
⚙️