SAFKY DEV - DOCS
YouTubeGithubDiscord
  • About SAFKY DEV
  • SCRIPTS GUIDES
    • ๐Ÿ”SAFE EVENTS
    • ๐Ÿ“˜GUIDEBOOK
    • ๐Ÿ’ŽS_PREMIUM
    • ๐Ÿ‘ชS_MULTICHAR
    • ๐ŸงชDRUGS
    • ๐Ÿ”ซTERRITORIES
    • ๐Ÿง ORGANS TRAFFIC
Powered by GitBook
On this page
  • 1. DEPENDENCY
  • 2. CONFIG FILE
  • 3. USAGE
  • 4. SQL

Was this helpful?

  1. SCRIPTS GUIDES

TERRITORIES

The ultimate territories system!

PreviousDRUGSNextORGANS TRAFFIC

Last updated 1 year ago

Was this helpful?

1. DEPENDENCY

OX_LIB -

2. CONFIG FILE

Config = {}

-- _____ _____ ____  ____  ___ _____ ___  ____  ___ _____ ____  
-- |_   _| ____|  _ \|  _ \|_ _|_   _/ _ \|  _ \|_ _| ____/ ___| 
--   | | |  _| | |_) | |_) || |  | || | | | |_) || ||  _| \___ \ 
--   | | | |___|  _ <|  _ < | |  | || |_| |  _ < | || |___ ___) |
--   |_| |_____|_| \_\_| \_\___| |_| \___/|_| \_\___|_____|____/ 

Config.CapturingTime = 30 --minutes
Config.CooldownTime = 60 --minutes
Config.RequiredCops = 0 --- @param Set how many cops online needed to start a attempt control, or let it '0'.
Config.MininumMembersRequired = 5 --- @param Modify how many members of the gang needs to be near you to control a territory

Config.PlayersCommand = "territories"
Config.ManageAdmins = {
    command = "territory",
    permission = { "admin", "god"},
}

--- @param The groups u create below will apear when u are creating a new territory, then u can set that territory to be able to control by the group u want only
Config.PermissionGroups = {
    ["group1"] = { "police", "ambulance", "forum"}, 
    ["group2"] = { "bairro1", "bairro2", "bairro3", "bairro4"}, 
    ["group3"] = { "police","vagos", "forum"},
}

--- @param Every job that are inside of your created groups need to be set below the color.
Config.JobColors = { -- Check blip colors here: https://docs.fivem.net/docs/game-references/blips/
    ["police"] = 63,
    ["ambulance"] = 1,
    ["marabunta"] = 38,
    ["forum"] = 25,
    ["banker"] = 1,
}

-- ____  ____  _   _  ____ ____    _    _     _____ ____  
-- |  _ \|  _ \| | | |/ ___/ ___|  / \  | |   | ____/ ___| 
-- | | | | |_) | | | | |  _\___ \ / _ \ | |   |  _| \___ \ 
-- | |_| |  _ <| |_| | |_| |___) / ___ \| |___| |___ ___) |
-- |____/|_| \_\\___/ \____|____/_/   \_\_____|_____|____/ 

--- @param Set 'money' to receive normal money 'QB & ESX'
--- @param Set 'item' to receive as item 'QB & ESX', in this case set the 'itemname' of your blackmoney item or other item u want to use as currency.
--- @param Set 'blackmoney' to receive on blackmoney account 'ESX ONLY'
Config.DrugSalesPaymentType = {type = 'item', itemname = 'water_bottle'}
Config.TimeToSell = 10 -- seconds
--- @param You can create as many dealers as you wish, every dealer u create will appear on the menu when u create a territory of type drugs, this will be the drugs available to sell on that territory
Config.DealersList = {
    ['dealer1'] = {
        ['weed4'] = {label = 'Weed', value = 100, amount = 10},
        ['weed4'] = {label = 'Weed', value = 200, amount = 10 },
    },
    ['dealer2'] = {
        ['coke4'] = {label = 'Coke', value = 100, amount = 10 },
    },
    ['dealer3'] = {
        ['meth4'] = {label = 'Meth', value = 100, amount = 10 },
    },
}

-- ____ ____      _    _____ _____ ____  
-- / ___|  _ \    / \  |  ___|_   _/ ___| 
-- | |   | |_) |  / _ \ | |_    | | \___ \ 
-- | |___|  _ <  / ___ \|  _|   | |  ___) |
-- \____|_| \_\/_/   \_\_|     |_| |____/ 

--- @param You can create as many crafts as you wish, every craft u create will appear on the menu when u create a territory of type craft
Config.CraftsList = {
    ['weaponcraft'] = {
        ['WEAPON_PISTOL'] = {label = 'GLOCK', time = 30, amount = 1, receipt = { ["weaponpieces"] = 20, ["receitapistola"] = 1 }},
        ['WEAPON_PISTOL50'] = {label = 'DEAGLE', time = 40, amount = 1, receipt = { ["weaponpieces"] = 30, ["receitapistola"] = 1 } },
        ['WEAPON_MACHINEPISTOL'] = {label = 'TEC-9', time = 50, amount = 1, receipt = { ["weaponpieces"] = 60, ["receitasmg"] = 1 } },
        ['WEAPON_ASSAULTSMG'] = {label = 'Assault SMG', time = 60, amount = 1, receipt = { ["weaponpieces"] = 70, ["receitasmg"] = 1 } },
        ['WEAPON_COMBATPDW'] = {label = 'PDW', time = 70, amount = 1, receipt = { ["weaponpieces"] = 80, ["receitasmg"] = 1 } },
        ['WEAPON_COMPACTRIFLE'] = {label = 'Mini AK', time = 100, amount = 1, receipt = { ["weaponpieces"] = 110, ["receitarifle"] = 1 } },
        ['WEAPON_BULLPUPRIFLE'] = {label = 'QBZ', time = 110, amount = 1, receipt = { ["weaponpieces"] = 120, ["receitarifle"] = 1 } },
        ['WEAPON_ASSAULTRIFLE_MK2'] = {label = 'AK-47 MK2', time = 120, amount = 1, receipt = { ["weaponpieces"] = 130, ["receitarifle"] = 1 } },
    },

    ['attachscraft'] = {
        ['armor'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 70, ["carbono"] = 75, ["tecido"] = 100 }},
        ['heavyarmor'] = {label = 'Heavy Armor', time = 20, amount = 1, receipt = { ["plastic"] = 100, ["carbono"] = 105, ["tecido"] = 180 } },
        ['at_flashlight'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 35, ["carbono"] = 40 }},
        ['at_suppressor_light'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 35, ["carbono"] = 40 }},
        ['at_suppressor_heavy'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 55, ["carbono"] = 60 }},
        ['at_grip'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 65, ["carbono"] = 60 }},
        ['at_barrel'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 55, ["carbono"] = 60 }},
        ['at_clip_extended_pistol'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 35, ["carbono"] = 40 }},
        ['at_clip_extended_smg'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 45, ["carbono"] = 50 }},
        ['at_clip_extended_rifle'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 55, ["carbono"] = 60 }},
        ['at_clip_drum_smg'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 55, ["carbono"] = 60 }},
        ['at_clip_drum_rifle'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 65, ["carbono"] = 70 }},
        ['at_scope_macro'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 35, ["carbono"] = 40 }},
        ['at_scope_medium'] = {label = 'Armor', time = 20, amount = 1, receipt = { ["plastic"] = 55, ["carbono"] = 60 }},
    },

}

--- @param Every item you will use in a receipt of a craft u need to set below the label.
Config.ReceiptLabels = {
    ["weaponpieces"] = 'Weapon Pieces',
    ["receitapistola"] = 'Receita Pistola',
    ["receitasmg"] = 'Receita SMG',
    ["receitarifle"] = 'Receita Rifle',
    ["plastic"] = 'Plastico',
    ["carbono"] = 'Carbono',
}

-- __  __  ___  _   _ _______   ___        _   _   _ _   _ ____  ______   __
-- |  \/  |/ _ \| \ | | ____\ \ / / |      / \ | | | | \ | |  _ \|  _ \ \ / /
-- | |\/| | | | |  \| |  _|  \ V /| |     / _ \| | | |  \| | | | | |_) \ V / 
-- | |  | | |_| | |\  | |___  | | | |___ / ___ \ |_| | |\  | |_| |  _ < | |  
-- |_|  |_|\___/|_| \_|_____| |_| |_____/_/   \_\___/|_| \_|____/|_| \_\|_|  

--- @param Set 'item' to receive as item 'QB & ESX', in this case set the 'itemname' of your blackmoney item or other item u want to use as currency.
--- @param Set 'blackmoney' to receive on blackmoney account 'ESX ONLY'
Config.BlackMoney = {type = 'item', itemname = 'black_money'}
Config.Laundry = {time = 30, amount = 50000, percentage = 0.10}
--- @param Set 'money' to receive normal money 'QB & ESX'
--- @param Set 'item' to receive as item 'QB & ESX', in this case set the 'itemname' of your money item or other item u want to use as currency.
Config.PaymentLaundryType = {type = 'item', itemname = 'money'}

-- ____  _        _    ____ _  ____  __    _    ____  _  _______ _____ 
-- | __ )| |      / \  / ___| |/ /  \/  |  / \  |  _ \| |/ / ____|_   _|
-- |  _ \| |     / _ \| |   | ' /| |\/| | / _ \ | |_) | ' /|  _|   | |  
-- | |_) | |___ / ___ \ |___| . \| |  | |/ ___ \|  _ <| . \| |___  | |  
-- |____/|_____/_/   \_\____|_|\_\_|  |_/_/   \_\_| \_\_|\_\_____| |_|  

--- @param Set 'money' to receive normal money 'QB & ESX'
--- @param Set 'item' to receive as item 'QB & ESX', in this case set the 'itemname' of your blackmoney item or other item u want to use as currency.
--- @param Set 'blackmoney' to receive on blackmoney account 'ESX ONLY'
Config.BlackMarketPaymentType = {type = 'item', itemname = 'black_money'}
Config.BlackMarket = {
    ['weaponpieces'] = {label = 'Pecas de Armas', price = 100},
    ['municao1'] = {label = 'Municao .50', price = 100},
}


-- _____ ____      _    __  __ _______        _____  ____  _  __
-- |  ___|  _ \    / \  |  \/  | ____\ \      / / _ \|  _ \| |/ /
-- | |_  | |_) |  / _ \ | |\/| |  _|  \ \ /\ / / | | | |_) | ' / 
-- |  _| |  _ <  / ___ \| |  | | |___  \ V  V /| |_| |  _ <| . \ 
-- |_|   |_| \_\/_/   \_\_|  |_|_____|  \_/\_/  \___/|_| \_\_|\_\

--- @param Change here the name of your resource framework if is custom or dont touch
Config.FrameworkESXResourceName = 'es_extended'
Config.FrameworkQBResourceName = 's_core'

--- @param Dont touch below, it will auto detect what framework u use
if GetResourceState(Config.FrameworkESXResourceName) == 'started' then
    Config.Framework = 'ESX'
elseif GetResourceState(Config.FrameworkQBResourceName) == 'started' then
    Config.Framework = 'QBCore'
end

function ShowNotification(msg, type) --- @param Modify normal notifications
    if type == 'primary' then 
        lib.notify({description = msg, type = 'primary'})
		--ESX.ShowNotification(msg)
		--QBCore.Functions.Notify(msg, "primary")
    end
    if type == 'error' then 
        lib.notify({description = msg, type = 'error'})
        --ESX.ShowNotification(msg)
	  	--QBCore.Functions.Notify(msg, "error")
    end
    if type == 'success' then 
        lib.notify({description = msg, type = 'success'})
        --ESX.ShowNotification(msg)
		--QBCore.Functions.Notify(msg, "success")
    end
end

3. USAGE

  • Admin Commands /territory create /territory delete

  • Players Command /territories

4. SQL

CREATE TABLE IF NOT EXISTS `s_territories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` text DEFAULT 'NewTerritory',
  `owner` text DEFAULT 'null',
  `label` text DEFAULT 'NUll',
  `radius` int(11) DEFAULT 50,
  `coords` longtext NOT NULL,
  `type` text DEFAULT 'default',
  `jobs` text DEFAULT 'group1',
  `dealer` text DEFAULT 'null',
  `craft` text DEFAULT 'null',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8mb4;

๐Ÿ”ซ
https://github.com/overextended/ox_lib