esx_p_gang_areas

2.00 EUR

esx_p_gang_areas

Youtube link: https://www.youtube.com/watch?v=3uDClZtUVFk

Idea: Different esx jobs can capture areas and collect area money from pickup points.

-2 unique modes: 

    1.Gunmode - collect points from peds. Capture other teams area.

    2.Areamode - each gang member provides points staying in the area. Gang with most points will rule the area.

-All gang members can participate on claiming areas.

-Areas can be permanently owned.

-Areas can be freed by police - they need to patrol in area.

-You can setup how much money area gives

-Easy to add extra money for areas (drug selling or any other activity).

-Easy to add messages for area owners (drug selling or any other activity).

-Database integration (area owners and moneys are saved on each update).

-Optimized - CPU usage stays 0.01 unless you are claiming gunmode area or collecting money from area.


Highly customizable:

-You can add as many areas you like.

-Each area can be configured separately in multiple ways:

    -Name, Money, Claiming time, Black money or cash, How many points you need, Size, Position, Pickup place, etc.

-Also many more settings for all areas.

-Choose if police can free areas.

-You can setup areas that cannot be captured.

-Not obfuscated so you can easily add your own features or edit current ones.

-Easy to translate for other languages. All texts are in Config file - default: English.

-Look configuration file below for all the customizations possibilities.


Requirements: 

-ESX (version 2 is not supported because its not ready).

-MySQL (this should be already there if you use ESX without sqlite).

-Server build must be (FX version cerulean (2020-05)) or newer.

-Tested with multiple different esx 1 versions


Limitations for Gunmode:

-One job can only try claim one area at same time - can't divide your gang members to different areas to claim them at the same time.

-Each area can be only claimed by one job time at the time - no multiple gangs trying to capture same area at the same time).


Original idea by Elvine^

Config

Config = {}

Config.Positions = {

{id=1, name="Mirror Park", money=0, blip=0, owner="", moneypertick=100, timetorob = 1000, canbecaptured=true, giveblackmoney=false, points=50, capturetime=0, size=350.0, gunmode=true, middlepos=vector3(1088.862,-532.022,61.902), pickuppos=vector3(1113.328,-645.204,57.675)},

{id=2, name="Paleto Bay", money=0, blip=0, owner="", moneypertick=50, timetorob = 600, canbecaptured=true, giveblackmoney=false, points=50, capturetime=0, size=800.0, gunmode=true, middlepos=vector3(-71.039,6338.685,31.49), pickuppos=vector3(-332.587,6302.141,33.089)},

{id=3, name="Grapeseed", money=0, blip=0, owner="", moneypertick=200, timetorob = 1000, canbecaptured=true, giveblackmoney=false, points=50, capturetime=0, size=600.0, gunmode=true, middlepos=vector3(2035.736, 4928.166, 40.646), pickuppos=vector3(1646.491,4843.915,42.014)},

{id=4, name="Sandy Shores", money=0, blip=0, owner="", moneypertick=100, timetorob = 1000, canbecaptured=true, giveblackmoney=false, points=30, capturetime=0, size=400.0, gunmode=true, middlepos=vector3(1707.025,3650.845,35.033), pickuppos=vector3(1536.935,3797.363,34.451)},

{id=5, name="Grove Street", money=0, blip=0, owner="", moneypertick=100, timetorob = 1000, canbecaptured=true, giveblackmoney=false, points=30, capturetime=0, size=400.0, gunmode=true, middlepos=vector3(45.82,-1676.442,29.296), pickuppos=vector3(6.126,-1816.786,25.353)},

{id=6, name="Vagos", money=0, blip=0, owner="", moneypertick=50, timetorob = 800, canbecaptured=true, giveblackmoney=false, points=50, capturetime=0, size=250.0, gunmode=true, middlepos=vector3(948.112,-1889.67,31.216), pickuppos=vector3(895.811,-1996.621,30.631)},

{id=7, name="Airport", money=0, blip=0, owner="", moneypertick=200, timetorob = 600, canbecaptured=true, giveblackmoney=false, points=50, capturetime=0, size=250.0, gunmode=true, middlepos=vector3(-949.106,-2585.029,14.469), pickuppos=vector3(-707.417,-2448.122,13.944)},

{id=8, name="Beach", money=0, blip=0, owner="", moneypertick=100, timetorob = 1200, canbecaptured=true, giveblackmoney=false, points=50, capturetime=0, size=200.0, gunmode=true, middlepos=vector3(-1230.607,-1492.893,4.35), pickuppos=vector3(-1131.163,-1551.775,4.354)},

{id=9, name="Del Perro Pier", money=0, blip=0, owner="", moneypertick=200, timetorob = 600, canbecaptured=true, giveblackmoney=false, points=50, capturetime=0, size=250.0, gunmode=true, middlepos=vector3(-1669.897,-1074.082,13.153), pickuppos=vector3(-1667.507,-1074.002,13.154)},

{id=10, name="City", money=0, blip=0, owner="", moneypertick=1000, timetorob = 300, canbecaptured=true, giveblackmoney=false, points=50, capturetime=0, size=1100.0, gunmode=false, middlepos=vector3(-561.923,-131.067,38.432), pickuppos=vector3(-561.923,-131.067,38.432)},

}


Config.PoliceNumberRequired = 2 --How many cops needed to do anything at all

Config.FirstTickAfterBootMinutes = 10 --How many minutes to wait after boot to start giving out money

Config.HowManyMinutesTickTakes = 10 --How often you get more money and update new owner for non gunmode areas

Config.MaxAreaAmountMoney = 100000 --How much money one area can hold

Config.IfMaxMoneyGoToZero = true --Reset area money to 0 if it has max money

Config.MinutesForCopCountUpdate = 10 --How ofter server side checks how many cops are connected - Don't go below 5

Config.CanPoliceDoStuff = true --Can police free areas

Config.CanPoliceCaptureIdleAreas = false --can police free nongunmode areas

Config.PoliceAreaCaptureAdjust = 1000 --Patrolling area points calculation. Higher value = slower points, lower value = faster points. 1000 default.

Config.MaximiumRangeToGetPeds = 40 --Distance how long you can you get points from peds

Config.AfterCaptureProtectionMinutes = 60 --if area is captured how long area is protected from new claim Note:only works if Gunmode=true

Config.DrawBlipsForNonCapturableAreaForOtherGangsThanOwner = false --true=non capturable area blips are only shown for area owners. false=everyone.

Config.NPCHandsUpTime = 5000 --ms (1000=1s). How long npcs holds hand up before you can get more points

Config.ExtraPointsForOwnerAfterRestart = 60 --After server or script restart how many extra points area job gets. 60 = 60minutes of one crew being in area

Config.AddExtraPedsForClaimers = true --Script tries to forcespawn more peds for claimers when caputuring area NOTE: only for gunmode

Config.EnableWayPointCommand = true --/gangarea - waypoint to closest gunmode pickup or closest non gunmode pickup if you gang owns the area.

Config.WaypointCommandName = "gangarea" --select command name for closest pickuposition waypoint location

Config.EnableTestCommands = false --Test commands test1, test2, test3, test4 - to try out adding money or messages to area owners - KEEP THIS FALSE ON LIVE ENVIRONMENT

Config.AllowedCrews = {

"mafia",

"mc",

"brotherhood",

}

-- Choose ESX job names to above table if you want that job is able to capture and own areas NOTE: use config for police, don't add here.


--[[

Positions table options:

id must match to database ids, must go from 1->

money -- irrelevant just a placeholder

blip -- irrelevant just a placeholder

owner -- irrelevant just a placeholder

moneypertick - how much money is added to area money per tick

timetorob - how many seconds crews have time to take area NOTE: only works when gunmode=true

canbecaptured - if area can be captured NOTE: only works when gunmode=false - Remember to change owner in database.

giveoutblackmoney - false = cash, true = blackmoney

points - Gunmode=true only - how many points team needs before they get the area

capturetime -- irrelevant just a placeholder

size - How big area is

gunmode - =false gangmembers or polices must be in area to capture it(RP FRIENDLY), =true gangmembers must point npcs with weapons.

middlepos - area middleposition

pickuppos - where you pickup money or start capturing area

points = Gunmode=true only - How many points crews need to get area for themself 

]]


Config.TextCollectMoney = "Press ~INPUT_CONTEXT~ to collect area money"

Config.TextPoliceFreeArea = "Press ~INPUT_CONTEXT~ to free the area"

Config.TextCaptureArea = "Press ~INPUT_CONTEXT~ to capture the area"

Config.TextYouHave = "You have"

Config.TextSecordsToPatrol = "seconds left to patrol in area"

Config.TextWrongZone = "You are at the wrong zone"

Config.TextSecordsToTakeover = "seconds left to capture the area"

Config.TextSomeOneIsTryingToCaptureArea = "Something is happening at your area:"

Config.TextYouCapturedArea = "You captured area:"

Config.TextYouLostArea = "You lost area:"

Config.TextYouCollected = "You collected money:"

Config.TextNoMoney = "Area has no money yet:"

Config.YourCrewIsAlreadyRobbing = "Your crew is already capturing area"

Config.TextAreaHasProtectionTime = "Area cannot be captured yet"

Config.TextAlreadyBeingRobbed = "Someone is capturing this area"

Config.TextNotEnoughCops = "Not enough cops"

Config.TextAreaIsFree = "Area is already free"

Config.TextArea = "Area"

Config.TextYouFreedArea = "You set the area free!"