Skip to content
All documentation

Faction

Factions you set up entirely in game: every faction is a real job with boss menu, garages, storages, wardrobe, elevator, level, action menu and gang war system. The script creates the tables itself.

Requirements
  • ESX Legacy (es_extended, tested with 1.14)
  • oxmysql
  • OneSync
  • For the wardrobe: skinchanger and esx_skin (or your own functions in config/functions.lua)
  • For the F6 menu and the gang war vehicle menu: esxmenudefault (or your own menus via ClientActionMenu and ClientGangwarVehicleMenu)

Features

  • Creator (/fraktionen): Create factions in game with ranks, salary, vehicles, locations (marker or NPC), blips and access from a certain rank.
  • Boss menu: Manage members, treasury with history, buy vehicles, permissions per rank, applications and logs.
  • Applications: Players apply to factions at application spots (NPC or marker from the creator), the leadership accepts or rejects in the boss menu.
  • GPS: Members see each other on the map, with their own icon on foot, in a car, on a motorcycle or bicycle, in a boat, helicopter or plane, while swimming and when dead (on/off per faction).
  • Faction vehicles with style: own plate prefix, paint and xenon in the faction color, max tuning and tinted windows. With a key to lock and unlock.
  • Garages and storages: up to 10 each per faction, access from a certain rank.
  • Wardrobe, elevator (up to 10 floors) and level with XP (on/off per faction).
  • Action menu (F6): Cuff, search, identify, escort and vehicle actions, selectable per faction.
  • Gang war: Create zones in game, modes Time limit and First Contact, own dimension, shop and leaderboard.
  • Discord logs for all areas.

Installation

  1. Put the off_faction folder into resources.
  2. Add to your server.cfg after oxmysql and ESX:
cfg
ensure oxmysql
ensure es_extended
ensure off_faction
  1. Open /fraktionen, create a faction and set the leadership with /setjob <ID> <name> <rank> (highest rank = number of ranks − 1).
Job names

The faction name is also the job name (2–20 characters, a–z, 0–9, _) and is fixed after that. If the job already exists, you can't create the faction.

Configuration

config/settings/config.lua

OptionDefaultDescription
serverInfo.name'OFF SCRIPTS'Server name, shown in the UI instead of "OFF SCRIPTS"
serverInfo.locale'de'Language: de, en, pl, fr, es or it
serverInfo.color{ 155, 89, 255 }UI color (RGB)
serverInfo.design3UI design: 1 = Classic, 2 = Receipt, 3 = Storefront
blurtrueBlurred background while a menu is open. The creator stays sharp (preview)
creator.command'fraktionen'Command for the creator
creator.groups{ 'projektleitung' }Groups for the faction creator
creator.zoneGroups{ 'projektleitung' }Groups for the gang war zone creator
inviteSeconds60Seconds until an invitation expires
storeRange25.0Max. distance when storing a vehicle (meters)
plateFormat'LLL NNN'Plate: L = letter, N = number, only applies without a prefix in the creator
applications.cooldown / maxOpen24 / 3Hours locked after a rejection, max. open applications per player
gps.interval / scale2 / 0.8Seconds between GPS updates, size of the blips
gps.showSelftruetrue = you also see your own GPS blip
gps.typessee filesprite and color per state: foot, swim, car, bike, bicycle, boat, heli, plane, dead (default white, dead red)
vehicleKeys.enabled / key / rangetrue / 'U' / 10.0Key system, default key, range in meters
vehicleKeys.sharedfalsetrue = all members can lock and unlock faction vehicles that are out
bossLogs.days30How many days logs stay saved in the boss menu
bossLogs.<area>true (actions false)Which areas the logs page shows: members, money, garage, storage, wardrobe, gangwarShop, level, actions
levels.max / base / growth50 / 1000 / 1.15XP per level = base × growth ^ (Level − 1)
levels.tiers5 tiersWith the level system: outfit slots and storage kg from a certain level
outfitSlots10Outfit slots without the level system
weaponWeight2.0Weight of one weapon in storage
itemImagesoff_inventory imagesImage path for items in storage, %s = item name
marker / blipssee fileDefault for new locations, adjustable per location in the creator. blips.enabled = false turns off all blips

config/settings/config.gangwar.lua

OptionDefaultDescription
times18:00 – 22:00Allowed times (server time), empty = always
joinSeconds60First Contact: join time in the lobby. Time limit starts right away
respawnSeconds10Seconds until respawn
lobbyRadius15.0Size of the lobby around the spawn (meters)
players.min / max1 / 0Players per side (min only First Contact, max = 0 = unlimited)
killPoints3Time limit: points per kill
modes.<mode>.duration25 / 15Duration in minutes
cooldowns1 / 0 / 1Minutes: attack (faction break), zone (zone lock), queue (until the queue expires), 0 = off
rewardssee fileGang war points and XP for win, lose, draw and forfeit
weaponsoffenabled = true: only these weapons in the gang war, your own come back afterwards
vehicles / shopsee fileVehicles of the gang war garages and shop items

config/settings/config.actions.lua

OptionDefaultDescription
command / key'fraktionsmenu' / 'F6'Command (/off_faction:fraktionsmenu) and default key for the action menu
reach3.0How close a player or vehicle in front of you has to be (meters)
search.requireCuffedtrueOnly search cuffed players
search.accounts{ 'money', 'black_money' }Accounts that can be taken when searching
cuffedAnimssee fileAnimations ClientIsCuffed uses to detect cuffed players
identifysee fileDisplay time and which fields show up for player and vehicle
animationssee fileAnimation and duration per action

config/functions.lua

This is where you hook up your own scripts. Errors in it end up in the console, the script keeps running.

FunctionPurpose
Notify(message, type) / HelpNotify(text)Notify and help text · Server: Notify(source, message, type)
ClientGetFuel(vehicle) / ClientSetFuel(vehicle, fuel)Fuel script
ClientVehicleRetrieved(vehicle, plate)After taking out a vehicle, e.g. give keys
ClientVehicleStored(plate)After storing a vehicle, e.g. remove keys
ClientGetSkin() / ClientApplyOutfit(clothes) / ClientRestoreOutfit()Clothing script for the wardrobe
ClientActionMenu(title, actions, onSelect)F6 menu (default: ESX default menu)
ClientIsCuffed()Cuffed check when searching (your own cuffs and animations)
ClientCuffChanged(kind)Own cuffs on or off, e.g. lock the phone
ClientGangwarDeath() / ClientGangwarRespawn()Death and respawn in the gang war, e.g. hide the ambulance script
ClientRestoreLoadout(loadout)Give weapons in the gang war and give them back
ClientGangwarVehicleMenu(vehicles, onSelect)Vehicle menu of the gang war garage
ClientGangwarVehicleSpawned(vehicle, plate)Gang war vehicle spawned, e.g. give keys
ServerLevelUp(faction, level)Faction levels up
ServerVehicleBought(faction, model, plate)Vehicle bought
ServerGangwarStarted(zone, attacker, defender)Gang war starts
ServerGangwarEnded(zone, attacker, defender, outcome)Gang war ended (outcome from the attacker's view)
ServerVehicleImpounded(source, plate)Vehicle impounded, e.g. connect another garage script
ServerCuffedDisconnect(source, xPlayer, kind, reason)Cuffed player leaves the server, e.g. jail

config/settings/config.server.lua and languages

Discord webhooks per area (creator, members, money, garage, storage, wardrobe, level, gangwar, actions), url = '' turns a log off. All texts are in config/locales/ (one file per language).

In game

  • Creator (/fraktionen): Create a faction, set locations with Use my position, markers, NPCs and blips via Customize, under Settings turn on the level system, garage, storage, gang war and the F6 menu actions. Only Save applies everything. At the top you switch to Applications and Gang war zones.
  • Adjust NPC: Pick a model from an image list of all GTA peds (search and categories), plus scenario and heading, all with live preview in game. You pick an addon ped by typing the exact model name into the search.
  • Vehicle style (Creator → Vehicles): Plate prefix with up to 5 characters, e.g. BALLA gives BALLA 48. If the prefix changes, all faction vehicles get a new plate when you save and vehicles that are out are removed. Plus paint in the faction color, max tuning, tinted windows and xenon in the faction color.
  • GPS (Creator → Settings): Members see each other on the map. The icon changes depending on the state, colors and icons are in gps.types. The blip only shows the heading on foot and while swimming, vehicle icons always stay upright.
  • Keys: Whoever takes out a faction vehicle can lock and unlock it with U (changeable in the FiveM key bindings). With vehicleKeys.shared = true all members can do that.
  • Applications: You create application spots in the creator under Applications (up to 20), as NPC or marker and optionally with a blip for all players. They apply to all factions. At the spot, E opens the list of all factions that accept applications, there you send a text. Your own faction isn't in the list. Members with the permission Invite members get a message and see the application in the boss menu under Members → Applications. You can also close applications there. Accepting also works when the player is offline.
  • Logs (boss menu, bottom button): everything that happens in the faction, e.g. deposits and withdrawals, vehicles taken out, stored or bought, storage, wardrobe, members, applications, gang war shop and level. Gang war attacks aren't listed there. Visible to the leadership and ranks with the permission View logs.
  • Locations: At the boss menu, garage, storage, wardrobe and elevator, E opens the menu.
  • Action menu (F6): Works on the player or vehicle directly in front of you.
  • Hard cuffs: only look around. Soft cuffs: walk, but not sprint, jump or attack. Select again to remove them.
  • Search: only cuffed players, you can only take things.
  • Escort: lead a cuffed player in front of you. Put in vehicle / Take out of vehicle for cuffed players.
  • Vehicle: wash, repair, impound (private vehicles end up in the off_garage impound) and identify. X cancels.
  • Gang war: At the gang war point, E opens the menu. One faction queues a zone, another one accepts. Join with E at the gang war point.
  • Time limit: starts right away, points per kill, respawn, joining possible until the end.
  • First Contact: join time in the lobby, then one life per player.

For developers

lua
exports.off_faction:AddXP('vagos', 250)
exports.off_faction:SetLevel('vagos', 5, 0)
local level, xp, needXp = exports.off_faction:GetLevel('vagos')
local faction = exports.off_faction:GetFaction('vagos')
local list = exports.off_faction:GetFactions()
local isFaction = exports.off_faction:IsFaction('vagos')
local name, grade = exports.off_faction:GetPlayerFaction(source)
local allowed = exports.off_faction:HasPermission(source, 'withdraw')
exports.off_faction:AddBalance('vagos', 5000, 'Reward')
exports.off_faction:RemoveBalance('vagos', 5000, 'Strafe')
  • All exports are server-side.
  • Server event off_faction:levelUp with (faction, level) on level up.
  • Statebags: offGangwar (zone ID in the gang war), offCuffed ('hard', 'soft' or false), offEscorted (server ID of the escorting player).

Common issues

On start, the script reports errors and hints in the server console.

ProblemSolution
“An ESX job with this name already exists”Pick a different name, existing jobs aren't taken over.
Nobody sees the marker or NPCOnly members see the locations. Set the position and save, check the minimum rank.
Wardrobe doesn't put anything onStart skinchanger/esx_skin or adjust the clothing functions.
F6 doesn't open a menuTurn on an action under Settings, start esxmenudefault.
Vehicle missing in the garageAssign it to the garage in the creator under Garages. Vehicles without a garage are in all garages. If it has a price, the leadership has to buy the vehicle in the boss menu first.
GPS shows nobodyTurn on GPS in the creator under Settings. It only shows members who are online.
U doesn't lockOnly whoever took out the vehicle, or everyone with vehicleKeys.shared = true. Check the key in the FiveM key bindings.
Application missing in the boss menuIt only shows up in the boss menu of the faction the player applied to, and only for ranks with the permission Invite members.
Logs page is emptySet the area in bossLogs to true. Entries are only created from now on, older actions aren't there.
“Gang wars are not allowed right now”Time is outside of times. For always: times = {}.
Ambulance script revives you in the gang warTurn off the death screen in ClientGangwarDeath.