Description
In this script there are different zones on the map (check screenshots), which can be owned by a faction. Every player can see the zones on the map (there are exceptions, like legal faction members). If a faction owns a zone then another faction(s) can attack the zone and the owners will need to defend it. Only one war can be fought at a time, if multiple factions want to fight a war then they need to wait until the other war is ended. The factions can attack in every three hours, and there is a protection time which means, if a war happened on a zone, then the zone will be protected for a period of time and cannot be attacked until then, this protection by default is two hours long. There are a lot of options about the war which can be edited (minimum member count to start a war, wait time until the war starts, during the war the players can be moved to another dimension, allow vehicles during the war, etc...). Owned faction zones can bring different supplies/items for the owning faction (by default the supplies arrive every two hours). There is a supplier around the map, the factions can take out their supplies from there (supplies can be: money, black money, items and weapons). Most of the things can be edited inside the configuration file which you can see below.
This is the first release, it is possible that some kind of bug(s) will appear. If you found some kind of bug please report here so I will be able to fix it.
Screenshots
Configuration file
Config = {}
Config.OldESX = false -- Change this if the server uses the old esx version (1.2).
Config.UseTarget = true -- Enable it if you use ox_target or qb-target in your server and you want to use targeting interaction.
Config.DefaultZoneColor = 0 -- Default (not owned) zone color is white
Config.ZoneAlpha = 175 -- Zone color intensity
Config.AreaProtectionTime = 120 -- How long will be a zone protected after a war ended (in minutes).
Config.RewardMinimumMemberCount = 5 -- Minimum member needed when the reward time has come.
Config.AreRewardsAvailable = true -- Set to true if you want to allow rewards for each zone.
Config.RewardDelay = 120 -- How often the factions will get rewards for the zones (in minutes).
Config.RewardLimit = 5 -- How much reward will be seen on the ui when the players select on the map.
Config.SuppliesUpdateTimeToDatabase = 5 -- How often the script will update the faction supplies to the database (in minutes).
Config.DoNotShowZonesForFactions = { -- Set which factions should not see the zones.
"police",
"ambulance",
}
Config.SupplierSettings = { -- Supplier NPC settings
Positions = { -- By default the npc spawns at one of these locations, you can freely modify it.
{
Coords = vector3(246.9893, -1965.443, 20.96166),
Heading = 226.431
},
{
Coords = vector3(812.0357, -107.8444, 79.61051),
Heading = 237.9898
},
{
Coords = vector3(1685.701, 3757.039, 33.38577),
Heading = 136.7538
},
{
Coords = vector3(-1307.28, -172.146, 42.82479),
Heading = 277.7745
}
},
PedModel = "cs_chengsr",
Blip = { -- Blip settings
Icon = 66,
Color = 13,
Size = 0.5,
Text = "Suspicious person",
ShowOnMinimap = false
},
TargetOptions = {
["OX"] = {
{
name = "david_warsystem:option1",
icon = "fa-solid fa-user-secret",
label = "Talk to supplier",
distance = 2.0,
onSelect = function()
TriggerServerEvent("david_warsystem:server:openSuppliesMenuForPlayer", playerData.job.name)
end,
canInteract = function(entity, distance, coords, name, bone)
return not IsEntityDead(entity)
end
}
},
["QB"] = {
options = {
{
num = 1,
type = "server",
event = "david_warsystem:server:openSuppliesMenuForPlayer",
icon = "fa-solid fa-user-secret",
label = "Talk to supplier",
action = function(entity)
TriggerServerEvent("david_warsystem:server:openSuppliesMenuForPlayer", (playerData.gang and playerData.gang.name) or playerData.job.name)
end,
canInteract = function(entity, distance, data)
return not IsEntityDead(entity)
end
}
},
distance = 2.0
}
},
InteractRange = 2.0, -- How close a player need to the npc to be able to interact with it.
DrawDistance = 150.0, -- How far away from the npc position should the script spawn the npc.
MenuCloseDistance = 3.5, -- If the player leaves the npc the menu will close.
ShouldUpdatePositionInTime = true, -- Should the npc position refreshed after a set amount of time.
PositionUpdateTime = 180, -- How long the npc should stay in one place (3 hours by default).
ShowAllPossiblePositionsOnMap = false, -- The map should show all the npc locations or just the current one.
}
Config.WarSettings = {
StartTime = 15, -- How long the system will wait after the attack to begin the battle (in minutes).
NotifyMinutes = {15, 10, 5, 3, 2, 1, 0.5, 0.25}, -- In which minutes the system should notify the faction members about the countdown.
AllowedMeleeWeapons = { -- Allowed melee weapons
"weapon_dagger",
"weapon_bat",
"weapon_bottle",
"weapon_crowbar",
"weapon_unarmed",
"weapon_flashlight",
"weapon_golfclub",
"weapon_hammer",
"weapon_hatchet",
"weapon_knuckle",
"weapon_knife",
"weapon_machete",
"weapon_switchblade",
"weapon_nightstick",
"weapon_wrench",
"weapon_battleaxe",
"weapon_poolcue",
"weapon_stone_hatchet",
},
FactionAttackCooldown = 180, -- How much time a faction need to wait after an attack (in minutes).
ShouldTeleportPlayersToOtherVirtualWorld = true, -- Set to true if you want to teleport the battle participants to another virtual world, so no one can bother them otherwise the battle will happen in the real world.
AllowVehicleTransfer = true, -- Set to true if it is allowed to bring vehicles into the battle.
AllowVehicleTransferInMeleeBattle = false, -- Set to true of it is allowed to bring vehicles into a melee battle.
ShowTeammatesOnMinimap = true, -- Set to true if it is allowed to show the faction members on the minimap.
ZoneLeaveWaitTime = 5, -- How long will the system wait before removing the player from the battle if he/she move out from the zone (in seconds).
MinimumMemberCount = 5, -- How much member each faction needs to be able to attack a zone (it is possible to attack a zone if each faction has te minimum member count).
}
Config.Factions = { -- Faction settings, attack grade = from which grade a member can attack a zone, color = which color can be seen in the map if the zone is under the faction control, check color here: https://docs.fivem.net/docs/game-references/blips/ at the bottom of the page.
["gsf"] = {Label = "Groove Street Families", AttackGrade = 3, SupplyManagementGrade = 2, Color = 2},
["vagos"] = {Label = "Vagos", AttackGrade = 2, SupplyManagementGrade = 1, Color = 5},
["ballas"] = {Label = "Ballas", AttackGrade = 3, SupplyManagementGrade = 3, Color = 7},
}
Config.Zones = {
["residentalpark"] = {
Label = "Residental Park",
Coords = vector3(-1033.47, -1072.83, 4.06),
Width = 200.0,
Height = 200.0,
Rotation = 30.0,
Rewards = { -- Rewards, it is possible to add money, black_money, items, and weapons (the weapon value means ammo count, not weapon count, if you want to add multiple weapons from the same type then you need to duplicate the rows).
{Item = "money", Value = 150000},
{Item = "black_money", Value = 5000},
{Item = "marijuana", Value = 150},
{Item = "WEAPON_PISTOL", Value = 50},
{Item = "WEAPON_ASSAULTRIFLE", Value = 100},
{Item = "cannabis", Value = 50},
}
},
["santamaria"] = {
Label = "Santa Maria",
Coords = vector3(-1638.45, -1039.51, 5.31),
Width = 120.0,
Height = 250.0,
Rotation = 320.0,
Rewards = {
{Item = "money", Value = 150000}
}
},
["docks"] = {
Label = "Docks",
Coords = vector3(981.31, -3007.21, 5.90),
Width = 200.0,
Height = 115.0,
Rotation = 0.0,
Rewards = {
{Item = "money", Value = 150000},
{Item = "black_money", Value = 5000},
}
},
["lumbermill"] = {
Label = "Lumbermill",
Coords = vector3(1177.75, -1319.97, 37.97),
Width = 130.0,
Height = 180.0,
Rotation = 0.0,
Rewards = {
{Item = "money", Value = 150000},
{Item = "black_money", Value = 50000},
{Item = "WEAPON_PISTOL", Value = 50},
}
},
["theather"] = {
Label = "Theather",
Coords = vector3(682.86, 565.29, 129.05),
Width = 220.0,
Height = 220.0,
Rotation = 340.0,
Rewards = {
{Item = "money", Value = 150000},
{Item = "black_money", Value = 5000},
}
},
["plaza"] = {
Label = "Plaza",
Coords = vector3(-2255.33, 296.53, 202.54),
Width = 220.0,
Height = 250.0,
Rotation = 200.0,
Rewards = {
{Item = "money", Value = 150000},
{Item = "black_money", Value = 5000},
{Item = "marijuana", Value = 100},
}
},
["constructionsite"] = {
Label = "Construction Site",
Coords = vector3(73.90, -407.63, 51.75),
Width = 145.0,
Height = 185.0,
Rotation = 160.0,
Rewards = {
{Item = "money", Value = 150000},
{Item = "black_money", Value = 5000},
}
},
["graveyard"] = {
Label = "Graveyard",
Coords = vector3(-1718.10, -205.91, 69.53),
Width = 205.0,
Height = 205.0,
Rotation = 140.0,
Rewards = {
{Item = "money", Value = 150000},
{Item = "black_money", Value = 5000},
{Item = "marijuana", Value = 30},
}
},
["factory"] = {
Label = "Factory",
Coords = vector3(529.68, -1958.38, 38.39),
Width = 120.0,
Height = 175.0,
Rotation = 120.0,
Rewards = {
{Item = "money", Value = 150000},
{Item = "black_money", Value = 5000},
{Item = "WEAPON_ASSAULTRIFLE", Value = 100},
{Item = "WEAPON_PISTOL", Value = 50},
}
},
}
Config.Language = { -- Language part.
["default_notify_title"] = "Notification",
["reward_notify_title"] = "Reward notification",
["war_notify_title"] = "War notification",
["reward_notify_text"] = "Your faction just got the rewards from all the posessed zones.",
["area_attack_not_available"] = "You can't attack this area for the next %s minute(s).",
["need_to_be_at_area"] = "You need to be inside of an area to use this command.",
["this_is_your_area"] = "This area belong to your faction, you can't attack this.",
["you_dont_have_enough_member"] = "Your faction don't have enough member(s) to begin the attack.",
["enemy_dont_have_enough_member"] = "The enemy faction don't have enough member(s) to be able to attack them.",
["no_attack_permission"] = "You don't have permission to start a war!",
["faction_not_registered"] = "Your faction is not registered inside the warsystem config!",
["attack_on_cooldown"] = "Your faction already attacked a zone, you need to wait %s minute(s) to be able to attack again.",
["war_in_progress"] = "One of the areas already attacked, you need to wait until the battle will end.",
["invalid_war_type"] = "Invalid wartype!",
["go_back_to_zone"] = "You have left the zone, you have %s second(s) to return to the area or you will be removed from the battle.",
["reason_zone_left"] = "player has left the zone",
["reason_server_left"] = "player has left the server",
["reason_died"] = "player died",
["reason_killed"] = "player killed by %s",
["reason_forbidden_weapon"] = "player had forbidden weapon(s) in inventory",
["player_removed_from_zone"] = "%s removed from the zone! (%s)",
["war_attacked_neutral_zone"] = "Your faction attacked %s, you have %s minute(s) to reach the area! If no one will be at the area after the countdown ends, then your faction won't get the zone.",
["war_attacked_neutral_zone_seconds"] = "Your faction attacked %s, you have %s second(s) to reach the area! If no one will be at the area after the countdown ends, then your faction won't get the zone.",
["war_attacking_minutes"] = "Your faction attacked %s owned by %s, you have %s minute(s) to reach the area! If no one will be at the area after the countdown ends, then the defenders will automatically win the battle.",
["war_defending_minutes"] = "%s has been attacked by %s, you have %s minute(s) to reach the area! If no one will be at the area after the countdown ends, then the attackers will automatically win the battle.",
["war_attacking_seconds"] = "Your faction attacked %s owned by %s, you have %s second(s) to reach the area! If no one will be at the area after the countdown ends, then the defenders will automatically win the battle.",
["war_defending_seconds"] = "%s has been attacked by %s, you have %s second(s) to reach the area! If no one will be at the area after the countdown ends, then the attackers will automatically win the battle.",
["war_started_attacker"] = "The battle has began, eliminate all of the enemies in the area to capture this zone!",
["war_started_defender"] = "The battle has began, eliminate all of the enemies in the area to protect this zone!",
["war_melee_cant_enter"] = "This battle is a melee battle, but you carrying a fireweapon, so you can't participate in it!",
["war_attack_failed"] = "No one was in the zone when the battle began, the defenders automatically won!",
["war_defend_failed"] = "No one was in the zone when the battle began, the attackers automatically won!",
["war_attackers_won_automatically"] = "There was no one in the zone from the defenders, from now on this zone is in your faction's posession.",
["war_defenders_won_automatically"] = "There was no one in the zone from the attackers, the zone left in your faction's posession.",
["war_out_of_battle"] = "You have been removed from the battle.",
["war_attackers_won"] = "All defenders eliminated from the zone. From now on the zone is in your faction's posession.",
["war_defenders_won"] = "All attackers eliminated from the zone. The zone left in your faction's posession.",
["war_attackers_lost"] = "The defenders eliminated all of your faction members in the zone. The zone remained in their posession.",
["war_defenders_lost"] = "The attackers eliminated all of your faction members in the zone, they captured the zone!",
["war_captured_zone_no_owner"] = "Your faction now owns this zone!",
["admin_zone_owner_changed"] = "You have changed %s zone owner to %s!",
["supplier_interact_message"] = "Use ~INPUT_PICKUP~ button to interact with the supplier.",
["money"] = "Money",
["black_money"] = "Dirty money",
["items"] = "Items",
["weapons"] = "Weapons",
["invalid_amount"] = "Invalid amount entered!",
["war_supplies_empty"] = "War supplies are empty!",
["no_supply_management_permission"] = "You dont have permission to manage the supplies!",
["supplies_updated_to_database"] = "[INFO] Warsupplies have been updated to database.",
["amount"] = "amount",
["pieces"] = "piece(s)",
["ammunition"] = "ammunition",
["never"] = "Never",
["none"] = "None",
["capturezone_command"] = "capturezone",
["capturezone_command_help_text"] = "Assign the zone which the player is inside to a faction.",
["capturezone_job_argument_text"] = "The faction's name.",
["war_command"] = "war",
["war_command_help_text"] = "Start a war between two faction for the zone.",
["war_wartype_armed"] = "armed",
["war_wartype_melee"] = "melee",
["war_command_wartype_text"] = "The type of the war (armed/melee).",
["enter_amount"] = "Enter the needed amount!",
["take_out_weapon"] = "Take out a %s with %s ammunition?",
["zone_details"] = "Zone details",
["name"] = "Name",
["owner"] = "Owner",
["last_attack"] = "Last attack",
["attack_possible"] = "Attack possible",
["rewards"] = "Rewards",
["rewards_not_available"] = "Rewards are not available",
["yes"] = "Yes",
["in_minutes"] = "In %s minute(s)",
["and_more"] = "And %s more...",
}
Config.SuppliesTableName = "war_supplies" -- The war supplies will be saved to this table in the database.
Config.ZonesTableName = "war_zones" -- The zone data will be saved to this table in the database.
Config.JobsTableName = "jobs" -- This is the table where the jobs can be found.
Features
- Factions can own zones/areas (every faction has it's own color)
- Owned zones can bring supplies/goods
- Owned zones can be attacked/defended
- There are different grade settings to start a war/manage faction supplies
- A war can be either melee or armed
- It is possible to play the war without the other players interruption (different dimension)
- Vehicles can be enabled during a war
- Custom User Interface to get data from the currently selected area
- Wars are synchronized for every player in the server
- Get items from the suppliers
- Works with ox_inventory too
- Works on ESX or QBCore framework
- Configurable language
- Optimized code
Dependencies/Requirements
- ESX (tested with v1.9.0) or QBCore (tested with v.2.1.0)
- ox_mysql
- ox_lib
Links
[ESCROW] Get resource from Tebex (15€ + tax)
[OPEN SOURCE] Get resource from Tebex (25€ + tax)
Code is accessible | ESCROW: Only Config file and UI, OPEN-SOURCE: Everything |
Subscription-based | No |
Lines (approximately) | ~1350 |
Requirements | Requirements can be found above |
Support | Yes |