Agents can also search and read this documentation through its MCP server.
Installation
Installation
Requirements
| Resource | Description |
|---|---|
| oxmysql | Required. Used to store the clans, wars and profiles. |
qb-core, qbx_core or es_extended |
Framework used for money, items and player data. |
| A supported inventory | Used for the clan storage and the loot feature. |
| A supported ambulance script | Used to detect downed players and revive them in wars. |
| screenshot-basic | Optional. Used to take photos of the war arenas. |
General Setup
- Extract the resource into your server's
resourcesfolder. - Make sure the folder name is strictly
hkn_clanwars. - Open
shared/config.luaand check the First Settings below. - Open your
server.cfg. - Make sure
oxmysql, your framework, your inventory and your ambulance script are started before this script. - Add the following line:
ensure oxmysql
ensure qb-core # or qbx_core / es_extended
ensure ox_inventory # the inventory you use
ensure qb-ambulancejob # the ambulance script you use
ensure hkn_clanwars
- Start your server. When everything is correct, you will see this block in the server console. If a line is red, check that setting.
==============================================
HKN CLAN WARS v1.0.0
----------------------------------------------
Framework : qb
Inventory : ox_inventory
Ambulance : qb-ambulancejob
Database : ready
==============================================
First Settings
Make sure to check these four settings in shared/config.lua.
| Setting | Description |
|---|---|
Config.Framework |
The framework you use: 'auto', 'qb', 'qbox' or 'esx'. 'auto' detects it automatically. |
Config.Death |
The ambulance script you use. 'auto' detects it. Use 'standalone' if you have none. |
Config.Storage.inventory |
The inventory you use. 'auto' detects it. |
Config.Admins |
Players who can see the Admin tab: citizenid, license:, steam: (hex) or fivem: identifier. |
Database
All tables are created automatically when the resource starts for the first time. You do not have to run any SQL by hand.
| Table | Description |
|---|---|
hkn_clans |
Clans. |
hkn_clan_members |
Clan members and their stats. |
hkn_clan_ranks |
Clan ranks and permissions. |
hkn_clan_requests |
Clan applications and invites. |
hkn_clan_storage |
Clan storage for esx_inventory. |
hkn_clan_wars |
War history. |
hkn_clan_arenas |
War arenas. |
hkn_clan_profiles |
Player profiles, cosmetics and stats. |
hkn_clan_settings |
Settings saved from the Admin tab. |
Ready-Made War Arenas (Optional)
If you do not want to draw the war arenas yourself, you can use the 4 arenas we prepared for you.
| Arena | Size |
|---|---|
| 5v5 Island | 5v5 |
| 15v15 Island | 15v15 |
| 30v30 Island | 30v30 |
| 50v50 Island | 50v50 |
- Start the server with the script at least once, so the
hkn_clan_arenastable is created. - Run the
hkn_clan_arenas.sqlfile from the script's folder on your database (HeidiSQL, phpMyAdmin, etc.). - Restart the script or the server.
Supported Ambulance Scripts
p_ambulancejob, qb-ambulancejob, ps-ambulancejob, qbx_medical, esx_ambulancejob, wasabi_ambulance, ars_ambulancejob, ak47_ambulancejob, tk_ambulancejob, standalone (no ambulance script)
Supported Inventories
ox_inventory, qb-inventory, qs-inventory, tgiann-inventory, ps-inventory, codem-inventory, lj-inventory, core_inventory, origen_inventory, mf-inventory, ak47_inventory, esx_inventory
Note:
esx_inventoryhas no stashes, so the clan storage is used from inside the panel (Clan Management > Storage).
Adding an Unlisted Inventory or Ambulance Script
If the script you use is not listed, you can add it yourself. These files are not encrypted, and each of them has an example at the top.
Inventory
File: shared/inventory.lua
- Add an entry for your inventory to the
InventorySystemstable. This defines how the storage is opened. - For the loot feature to work, add the
depositfunction to the same entry. This puts an item into the storage. - Put the entry's name into
Config.Storage.inventory.
Ambulance Script
- In
client/bridge.lua, add a function toDeathSystemsthat returns whether the player is down. - In
server/bridge.lua, add a function toReviveSystemsthat revives the player. - Give both entries the same name and put that name into
Config.Death.
Other Framework Code
Money, giving and taking items, and dropping weapons are handled in server/bridge.lua.
Usage
Commands
| Command | Description |
|---|---|
/clanwars |
Opens the Clan Wars panel. Default key: F7. |
/clancoin [id] [amount] |
Gives coins to a player. A negative amount takes coins. Admins only. |
War Keys
| Key | Description |
|---|---|
F9 |
Shows or hides the score panel. |
F10 |
Shows or hides the scoreboard. |
F11 |
Shows or hides the kill feed. |
F6 |
Shows or hides the key list. |
Y |
Votes to start the war in the lobby. |
U |
Reopens the lobby screen. |
All keys can be changed by each player in the FiveM key bindings menu.
Admin Tab
Only players listed in Config.Admins can see the Admin tab. It is used to set:
- The season name and end date.
- The clan creation and clan rename prices.
- The war arenas (Admin > Arenas).
War Types
| War Type | Description |
|---|---|
| Score | The first clan to reach the kill goal wins. |
| Timed | The clan with the most kills when the time runs out wins. |
| Zone | Battle royale. Players parachute in, the zone shrinks and there is no respawn. |
| Flag | Hold the flag or capture the enemy flag. |
| Area | Capture and hold points to earn score. |
| Team | Round-based war. The clan that wins the most rounds wins. |
When challenging a clan, you can also choose respawn, drops, loot, a money reward and the lobby time.
- Lobby: Before a war starts, the players gather on the lobby screen. The war starts when the time is up or when most players vote for it.
- Money reward: Taken from both clans' treasuries and paid into the winning clan's treasury, minus the commission.
- Loot: The losing side's weapons and the items in
Config.Lootgo into the winning clan's storage.
Exports
These server-side exports let other scripts work with the coins and wars.
| Export | Description |
|---|---|
GetCoins(citizenid) |
Returns the player's coin balance. |
AddCoins(citizenid, amount) |
Adds coins to the player. Returns true on success. |
RemoveCoins(citizenid, amount) |
Takes coins from the player. Returns false if the balance is too low. |
GetActiveWars() |
Returns the list of running wars. |
GetAcceptedChallenges() |
Returns the accepted war challenges. |
StartWar(data) |
Starts a war. |
UpdateWar(id, data) |
Updates a running war. |
EndWar(id) |
Ends a running war. |
RemoveChallenge(id) |
Removes a war challenge. |
local coins = exports['hkn_clanwars']:GetCoins(citizenid)
exports['hkn_clanwars']:AddCoins(citizenid, 100)
Common Problems
"Inventory script not found"
Your inventory is not listed, or the script starts before the inventory. Check the order in server.cfg and the Config.Storage.inventory setting.
A war cannot be started: "There is no war arena"
There is no usable war arena yet. Draw one in Admin > Arenas (both sides need spawn points) or install the ready-made arenas.
The Admin tab is not visible
Your identifier is not in Config.Admins.
A dead player is not counted or does not get up
Config.Death is wrong. Look at the Ambulance line of the startup block in the console. It should show the name of the script you use.
Looking into a problem
Set Config.Debug = true. War logs are printed to the server console and to the player's F8 console.
Updating
When a new version is released, an UPDATE AVAILABLE block appears in the server console. Download the latest version from the Cfx.re Portal.
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending
.mdto page URLs; this page is available as Markdown.