Stop Losing Server Revenue and Player Progression to Distributed State Exploits
Vanilla ox_inventory was designed with a fundamental flaw: it treats the server's volatile RAM memory as the absolute "source of truth" while letting database saves catch up lazily in the background. If a player triggers a rapid network desync or a sudden client crash, that memory state evaporates. Cheaters exploit this time window to duplicate millions of dollars in real-money assets, entirely bypassing standard anti-cheats.
The OX Inventory Transaction Engine completely rewrites the transaction pipeline. It forces the system to operate under a strict financial ledger model, turning a baseline "lazy-save" script into an absolute, zero-trust atomic transaction state machine.
| Feature | Vanilla ox_inventory | OX Inventory Transaction Engine |
|---|---|---|
| Source of Truth | Volatile Server RAM | The Hard Disk Database |
| Data Reliability | Database is treated as a lazy background backup task. | RAM is strictly a read-cache of confirmed database records. |
| Lock Mechanism | Short-Sighted Mutex | State-Synchronized Cage |
| Mutex Lifecycle | Automatically drops slot locks early before disk storage commits. | Holds locks hostage across threads until a hard write is confirmed. |
| Network Security | Vulnerable to net-limiting, packet flooding, and overlapping payloads. | Absolute immunity; concurrent spam attempts hit a firewall and drop. |
| Crash Protection | High Duplication Risk | Write-Ahead Snapshots |
| Rollback Safety | Mid-trade disconnects evaporate memory, causing server duplication. | Safely restores exact, uncorrupted pockets if database writes fail. |
🛡️ What This Permanently Closes
The Alt-F4 / Disconnect Exploit Loop: Whether a player drops an item, moves cash, or consumes a real-money asset, their inventory state is forcefully committed to your database before the world entity is allowed to render or the network response clears. Yanking an ethernet cord or task-killing the game client simply saves their new, reduced count.
Net-Limiter & Packet-Flood Immunity: While vanilla solutions use locks that collapse the moment the main thread returns, our system forces the memory firewall to stay tightly held across multiple threads. By keeping the slot keys locked for the entire duration of the background database transaction lifecycle, any rapid, overlapping event spam or throttled network payloads sent by a modder hit an active, un-yielding wall and are instantly dropped by the server.
Cross-Container Stash & Trunk Race Conditions: If multiple players attempt to click-spam or execute macros inside a shared container simultaneously to force an auto-save race window, the server freezes the callback execution stream, forcing the database engine to process the queries sequentially.
⚙️ Under the Hood Architecture
Intelligent Thread Shifting (Non-Blocking): The engine shifts the heavy lifting of database writes away from your main game loop and into isolated, frame-yielding background lanes. By utilizing specialized state flags, the main server thread effortlessly coordinates with your database without ever hitching, stuttering, or dropping server frames.
Micro-Targeted Mutex Firewalls: Unlike sloppy script locks that freeze entire player inventories, our firewall isolates only the exact item cells being moved. The rest of the player’s inventory—and your entire server tick rate—remains wide open, fluid, and lightning-fast.
Universal Backward Compatibility: Engineered to load flawlessly on both legacy library builds and the absolute newest resource versions. The script automatically implements callback fallbacks and state-bag safeguards, completely protecting your asset highway from breaking during future framework updates.
🏆 Why Your Economy Requires This
When players spend actual money on your server, they are buying scarcity and transaction security. Relying on a memory-first architecture means accepting that a single hardware hitch or network exploit can inflate your economy, ruin player trust, and directly drain your real-world server revenue.
The OX Inventory Transaction Engine treats your virtual items like a secure banking ledger. It guarantees that an item movement is either 100% written to the physical disk, or cleanly rolled back to a perfect snapshot. Protect your investments, secure your economy, and lock down your server today.
- Q: Won't forcing the main thread to poll a database status loop trigger server hitches?
- A: No. Per-transaction overhead is near zero. Our architecture processes operations concurrently by spinning up multiple dedicated background workers to handle heavy JSON encoding, durability tracking, and query execution simultaneously. The main thread loop simply evaluates a localized state flag. Specifically, it utilizes a native
Wait(0)frame-yielding handshake. This explicitly tells the game engine's scheduler to step aside on every frame tick, allowing the server to process everyone else's movements, syncs, and scripts at maximum speed. Your Server FPS remains completely unaffected. - Q: Doesn't tying the user interface response to a database write create massive input lag?
- A: Only if your database is misconfigured or running on a mechanical HDD. Relational database engines (like MySQL/MariaDB) do not necessarily need to force a physical disk write at every save line. Instead, the transaction can write instantly into the engine's high-speed RAM memory map cache (such as InnoDB's Buffer Pool). The database server instantly replies with a success token to our script, freeing the lock gates before it ever begins asynchronously flushing the transaction down to the physical enterprise NVMe storage. On an optimized server, this in-memory pipeline clears in milliseconds—meaning transactions can complete in less than a single server tick. Players feel zero input lag, and the slot is kept secure during that microsecond window.
ox_inventory resource.ox_inventory directory with this secure version.Legal Notice
This software is a source code copy of OX INVENTORY TRANSACTION ENGINE which is based on ox_inventory and is licensed under the GNU General Public License version 3 (GPLv3).
No Warranty
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the included LICENSE file for more details.