Page cover

briefcase-blankSociety

The Codex Society system is a configurable job and society management system for RedM servers. It provides shared society accounts, employee management, job stashes, duty systems, salaries, job chat,

codex_society is a fully configurable job & society management system for RedM (VORP Core).

It is designed so that customers only need access to the configuration file and public exports. All core logic is CFX escrowed and never needs to be edited.


Key Features ✨

  • 🏦 Society / Job Accounts Shared job money stored in the database (deposits & withdrawals).

  • 👥 Employee Management Hire, fire, promote, demote, and manage access to the job account.

  • 🕒 Duty System On/Off-duty with blip color changes for visibility.

  • 📦 Job Stash Shared inventory per job using vorp_inventory.

  • 👚 Wardrobe Integration Configurable function to hook into any clothing/wardrobe script.

  • 💵 Salary System Per job and per grade salaries, paid every X minutes.

  • 💬 Job Chat Optional job-only chat channels.


Requirements 🧩

Framework / Core

  • VORP Core

Dependencies

Make sure these start before codex_society:

  • oxmysql – database handler

  • vorp_inventory – shared inventories/stashes

  • codex_core

  • mega_nplayerselector – used for hiring menus

  • fx-input – input menus for UI

Example server.cfg order:

Files Included 📁

  • fxmanifest.lua – resource metadata (do not modify unless you know what you’re doing)

  • config.lua ✅ – main configuration file (this is what your customers edit)

  • docs.lua ✅ – examples of how to use exports/events in other scripts

  • insert.sql ✅ – required database structure

  • client.lua / server.lua (encrypted) – main logic (not editable by customers)

🛡️ Important: Customers should only touch:

  • config.lua

  • Their own scripts that call the public exports/events.


Database Setup 🗄️

  1. Open your database manager (Heidisql, etc.).

  2. Import the provided insert.sql file.

  3. This will create the table used by codex_society to store society account balances.

⚠️ Do not modify the table structure unless you know exactly what you’re doing. The script relies on the schema created by insert.sql.


How Players Use It In-Game 🎮

Once configured:

  • Players with a configured job go to the job location you set in config.lua.

  • They see a 3D text prompt (e.g. [G] - Job Menu).

  • Press the configured key (by default G) to open:

    • Society account / ledger

    • Employee management (boss only)

    • Job stash

    • Wardrobe (via your wardrobe system)

  • Use commands like /onduty, /offduty, /job (names configurable) for:

    • Duty status

    • Job chat


Page 2 — Configuration ⚙️

Commands 💬

  • /onduty – puts player on duty, updates blip color.

  • /offduty – puts player off duty.

  • /job – sends a message in job-only chat (if enabled for that job).

You can rename these, e.g.:

📝 Don’t forget to update your server rules / help commands if you rename them.


  • MenuOpen – control hash for the key that opens the job menu (default G).

  • Text – 3D text prompt shown near the job menu location.

  • MenuDistance – max distance from the job location where menu can be opened.


Wardrobe Integration 👚

This function is called when a player selects Wardrobe in the job menu.

To use a different wardrobe script, replace the body:

🔗 This is the only place you plug your wardrobe system into codex_society.


Salary System 💵

  • Config.SalaryMinutes

    • Interval (in minutes) between salary payouts.

  • Config.SalaryJobs

    • Key: job name (string)

    • Value: table of [grade] = amount

Example:

Set an amount to 0 if a grade should not receive salary.


Job Configuration 🧭

Each job you want managed by codex_society goes into Config.Jobs.

Example Job

Field Breakdown 🧾

  • Key ('saloonval')

    • Must match the job name used by your framework.

  • JobLabel

    • Human-readable label for notifications & menus.

  • Location (vector3(x, y, z))

    • Position where the job menu can be opened.

  • Blip

    • Enabled – enable/disable map blip.

    • Sprite – blip icon ID.

    • OffDutyColor – color when off duty.

    • OnDutyColor – color when on duty.

    • Name – label on the map.

  • Chat

    • Enabled – enable job-only chat for this job.

    • Label – prefix used in job chat messages.

  • Inventory

    • Label – name of the job stash.

    • Capacity – stash capacity (items/weight, depending on your inventory setup).

  • BossRank

    • Grade that counts as boss (management access).

  • InventoryOpen

    • Minimum grade required to open job stash.

  • JobMinimumGrade

    • Grade assigned when hiring a new employee.

  • Webhook

    • Discord webhook URL for logs (hire, fire, duty, etc.).

    • Leave empty '' to disable logging.


Locales / Translations 🌐

Config.Locales holds translated strings.

To add a new language:

  1. Copy an existing locale entry (e.g. ['en']).

  2. Paste as a new key, e.g. ['fr'] = { ... }.

  3. Translate all values.

  4. Set:

🚨 Do not remove keys from the locale tables. The script expects them to exist.

Server-side

Lab typically provides helpers like Lab.GetJob() and Lab.GetJobGrade().


Client Event: Open Job Inventory 📦

Use this to open the job stash of the player’s current job.

  • Sends the player’s job name to the server.

  • Server opens the configured job inventory for that job.

Use this when:

  • You build your own job menu.

  • You want a custom keybind to open the job stash.


Server Export: GetAccountMoney 🏦

Read the current society balance for a job.

  • jobName: string, e.g. 'saloonval', 'doctor', 'sheriff'

  • Returns: number – society money stored for that job.

Example

🔍 Recommended usage: Use this export for checks only, like:

  • Check if a society can afford a purchase.

  • Display society money in a custom UI.

  • Generate statistics or logs.


Server Export: DepositAccountMoney 💰

Deposit money into a job’s society account.

  • jobName: string – job identifier (must exist in Config.Jobs).

  • amount: number – how much to add.

Example

Use cases:

  • Rewards from job-specific missions.

  • Business income going into a shared company safe.

  • Event rewards that should benefit the entire job, not just one player.

⚠️ Important: DepositAccountMoney only affects the society account, not the player’s cash/inventory. You are responsible for managing personal money in your own scripts.


Summary 🧾

Available public interfaces (for customers):

  • Client

    • TriggerServerEvent('codex_society:openInventory', jobName)

  • Server

    • exports['codex_society']:GetAccountMoney(jobName) → number

    • exports['codex_society']:DepositAccountMoney(jobName, amount) → deposit into society account

These are designed to be used for checks and controlled interactions only, without exposing private logic.


2. Check Society Balance Before an Upgrade (Server)

Require the job to have enough society money to purchase an upgrade.

🧠 The export here is used purely for a check before running your own logic.


3. Custom Keybind to Open Job Stash (Client)

Open the job stash when the player presses H near a specific location.

This uses the same society stash as the main script. No duplicate inventories.


FAQ ❓

“Players can’t open the job menu.”

Check:

  • The player’s job exists in Config.Jobs.

  • The coordinates in Config.Jobs[job].Location are correct.

  • The player is within Config.MenuDistance.

  • No other script is blocking the menu key.


“Society account is always 0.”

  • Confirm insert.sql was imported correctly.

  • Make sure you use the correct job name when calling exports.

  • Ensure that job is configured in Config.Jobs.

  • Check that your own scripts are actually calling DepositAccountMoney.


“Job chat isn’t working.”

  • Set Config.Jobs[job].Chat.Enabled = true.

  • Make sure players use the correct chat command (Config.Commands.Chat).


“Can I change salary per grade?”

Yes. In Config.SalaryJobs:

Each grade ([0], [1], etc.) can have a different amount.


Changelog 📝

v1.0

  • ➕ Added mega_nplayerselector dependency for hiring.

  • ➕ Integrated new input menu resource fx-input.

  • 🐛 Fixed multiple reported bugs.

  • 🔧 Added JobMinimumGrade per job in config.


v1.1

  • 🔁 Migrated all database queries to oxmysql.

  • ⚙️ Optimized server-side performance & query handling.

  • ⚡ Improved Manage Employees menu refresh speed.

  • 🐛 Fixed additional reported bugs and edge cases.

Last updated

Was this helpful?