🟧 [ESX][QB] XeX Gang Wars - Conquest of territories by gangs

Hi! I release a simple gang territory conquest script. Optimized for ESX and QB, expandable as needed. It can be integrated with polyzones or another system if necessary.

It works by time, it is configurable from the capture time between points, the time to capture a point, the colors of each band, the zones, etc…

The zones are reset at each restart. You can add as many zones as you want and randomly select some of them at each reboot (Or all).

I remain attentive to any questions!

Links:
Github

Preview:

XeX Scripts:
:gun: XEX WEAPONLICENSES
:pill: XEX MEDICALHELP
:moneybag: XEX LOOTBOX
:airplane: XEX PILOTJOBS
:warning: XEX EAS
:pushpin: XEX BLIPS CREATOR

13 Likes

goow work, is color will work with custom postal map

1 Like

woooow man its first time i see something like this for free thank you very much bro

a question can you make that zone will remain after restart ?

1 Like

thanks a lot! What do you mean by custom postal map?

1 Like

Thanks!! Not in the current version, although it is not very complicated to implement. In the future I may raise it, if someone is encouraged they can participate in the mod and create PR’s!

1 Like

okay bro, good works, maybe you could do it more advanced? while you capturing the zone, npc bots attacking you, you have a attack waves to defeand/capture the zone’s?

3 Likes

Thx!! At the moment I do not plan to extend it but if there are many people interested in a functionality we may try to carry it forward. You can also make your own implementations on top of this version.

1 Like

that i mean but its working 100% :kissing_heart: :ok_hand:
and i have question how to get the color id ?

2 Likes

Hello! It is hexadecimal format.

#ffffff = 0xffffff
#ffffff = 0xffffff80 (white with 80% opacity)

2 Likes

Hi, can you give me the site you use to set the colors of the zones i’m going crazy?
Thanks and great job!

1 Like

Hi! I just expanded the documentation and added a resource to get the colors. Take a look here.

can you make everyone want to rule this place need items like white flags to be the place of organization

1 Like

This would require changing the focus of the current system. Currently the restriction is by Job, if you do not have the job that you have previously defined, it will not let you conquer. As I said, it can be adapted so that anyone can conquer the points and require the item, you can also make each attempt to conquer remove an item from your inventory.

Code is open! :bulb:

1 Like

Hello Dude and BIG THX for a free script like this! :heart_eyes:

today I started the script on my server and had to change a few things to get it working how I want it to work.

Seeing your code let me know you know much more about coding then I do and maybe my suggestions inspire you…

first at all I’ve changed the following in the server lua

 --account.addMoney(v.capturePrice)
xPlayer.addMoney(v.capturePrice)

this worked flawless

and I had to change the config like that:

Config.timeBetweenConquers = 600 -- 10min default - Time between conquers

because in my case the os.time() counts in seconds not milliseconds.
this worked flawless too.

then I recnognized that Players with a other Job cant capture the point even if its “Conquerable”
so i changed this:

    Citizen.CreateThread(function()
        while true do
            Citizen.Wait(120000) -------------------------------------
            print(ESX.GetPlayerFromId(source))
            print(os.time())
            for k, v in pairs(zones) do
                if (v.owner ~= '' and os.time() > v.conqueredTime + Config.timeBetweenConquers and v.latestPointTime ~= '' ) then
                print("wieder verfuegbar")
                    v.status = 2
                    v.latestPointTime = ''
                    v.pointRecent = false ------------------------------------------------------------------
                    TriggerClientEvent('xex_gangwars:setZones', -1, zones)
                end
            end
        end
    end)

its working for me now but when the point is “Conquerable” again the same job can capture it again and it would be great to get a option if player want it or it have to be captured by another “gang”.

I hope you understood my bad english and maybe you implement these things the good way… not that way I did because your code looks much cleaner!

Greetings,
Mikrolai!

2 Likes

Hello Mikrolai,

Thanks for your comment, I’m glad you like it.

The script is mainly based on the job of the person to paint the colors and control the zones. If you have not added the Jobs to the Config.gangJobs table you may have this problem when saving a point. You can try adding them there and try. Otherwise, you may have to do some more adaptation to make it work correctly.

At this point:

v.color = Config.gangJobs[gang].color

Is being assigned a color based on that table. And also an owner according to the job:

v.owner = gang

I hope it helps you, greetings!

sure I’ve inserted the jobs in the config before
I have to insert in line ~98 in server lua

v.pointRecent = false

to make the point “Conquerable” for others again after the waiting time why?
Is this the right way?

my problem is when I use this script without changing this the point says it is “Conquerable” again but other jobs cant capture it. Why? is this a bug?

1 Like

There are 2 loops, one changes the state of the zone to conquerable, and the other checks that a point has not been captured recently. Between captures there is a delay.

Modifying it in the way you indicate you are mixing the two actions in the same loop. Cheer up, greetings!

how to make a conquerable point attackable for other jobs then?

In the tryToConquerZone() function, check before doing anything that this point does not already belong to that job. If owner property it’s equal to the job of the person trying to conquer, don’t let them do it.

if v.owner ~= yourjob then
 -- Conquer
else
 --- Stop it
end

I think with that you will be able to make it work. Greetings!

1 Like

first at all thanks but I think you missunderstand me.

If I don’t insert v.pointRecent = false in the server lua as I written above nobody ever can capture the point again once its captured.
even if its conquerable again no matter wich job the player has.

If I insert v.pointRecent = false like I written it works but it should do that without that… am I wrong?