CodeM Trading Script (ESX/QB)
CodeM Trading Script - professional ESX script with custom features and optimized performance for FiveM servers Compatible with ESX framework.
Video Preview
Click to load video from YouTube. By watching, you agree to their privacy policy.
CodeM Trading Script - Secure Player-to-Player Item & Currency Exchange System
CodeM Trading Script enables safe and intuitive player-to-player trading on your FiveM server. This comprehensive trading system features real-time item exchange, currency transactions, dual confirmation requirements, anti-scam protections, trade history logging, modern UI interface, distance-based trading, and complete framework integration - creating a secure marketplace where players can exchange items, vehicles, and money directly without admin intervention or risky drop-trading.
https://www.youtube.com/watch?v=frGpSMBBDQcWhat's Included
This complete trading package includes secure trade window interface showing both parties' offerings, item exchange supporting any inventory items with quantity controls, money trading with configurable limits, dual confirmation system requiring both players to accept, real-time trade updates as items are added or removed, trade cancellation allowing either party to abort, anti-scam protections preventing item duplication and exploits, trade history tracking completed transactions, distance-based trading requiring physical proximity, timeout mechanics preventing indefinite open trades, and comprehensive logging for dispute resolution.
Key Features
- Secure Trade Window - Split-screen interface showing your offerings on one side and partner's offerings on other with clear visual separation
- Item Exchange - Trade any inventory items with quantity selection, weight checking, and metadata preservation (weapon attachments, durability, etc.)
- Money Trading - Exchange cash alongside items with configurable minimum/maximum transaction limits and black money support (ESX)
- Dual Confirmation - Both players must click Accept before trade executes preventing rushed or accidental transactions
- Real-Time Updates - Trade window updates instantly when items added/removed showing current offerings before final confirmation
- Trade Cancellation - Either party can cancel trade at any point before final confirmation with automatic item return
- Anti-Duplication Protection - Server-side validation prevents item duplication exploits and inventory manipulation
- Distance Requirements - Players must be within configurable proximity to initiate and maintain trades preventing remote scam attempts
- Trade Requests - Send trade requests to nearby players showing notification they can accept or decline
- Trade History - Complete log of all completed trades with timestamps, items exchanged, and participants for dispute resolution
- Timeout System - Trades automatically cancel after configurable inactivity period preventing indefinite hanging trades
- Weight Verification - Checks both players have sufficient inventory capacity before allowing trade execution
- Blacklist System - Configure items that cannot be traded (admin tools, special items, quest objects)
- Trade Cooldowns - Optional cooldown periods between trades preventing spam trading or market manipulation
- Sound Effects - Audio feedback for trade requests, item additions, confirmations, and completions
Perfect For
- Economy Servers - Enables player-driven economy with direct item and currency exchange without NPC vendors
- Roleplay Servers - Supports realistic trade scenarios like merchant roleplay, business transactions, and personal item sales
- Survival Servers - Essential for resource trading, equipment exchanges, and community cooperation
- Public Servers - Prevents scamming through drop-trading by providing secure, transparent exchange mechanism
- Whitelisted Communities - Facilitates player interaction and commerce in closed communities
- Job Systems - Supports business transactions like buying supplies from wholesalers or selling products to customers
Trading Process Workflow
Initiating Trade: Player approaches another player (within configurable radius, typically 3-5 meters) and opens trading menu selecting target player. Target receives notification with trader's name and can accept or decline. Upon acceptance, trade window opens for both players simultaneously.
Adding Offerings: Each player independently adds items from their inventory and/or money to their side of trade. As items are added, they appear in real-time in both players' trade windows. Players can remove items before final confirmation. Weight checks ensure receiving player has inventory space.
Confirmation Phase: When both players are satisfied with offerings, each clicks Accept button. First acceptance shows Waiting for other player status. Once both accept, short countdown (3-5 seconds) begins allowing final review. Either player can still cancel during countdown.
Trade Execution: After countdown, items and money are simultaneously transferred between inventories. Server validates all transfers preventing duplication. Success notification appears for both players. Trade window closes automatically. Transaction logged to history.
Cancellation: Either player can click Cancel at any point before final countdown. All offered items instantly return to original owners. Trade window closes with cancellation notification.
Anti-Scam Protections
Server-Side Validation: All trades execute server-side with validation checks ensuring players actually own offered items, sufficient inventory space exists for receiving items, money amounts are accurate and within limits, items aren't duplicated during transfer, and metadata is correctly preserved. Client-side displays are verified against server authority preventing manipulation.
Confirmation System: Dual confirmation requirement prevents quick switch scams where traders change offerings last second. The 3-5 second countdown after both accept provides final review opportunity. Real-time updates show exactly what each player is offering before execution.
Distance Enforcement: Trades automatically cancel if players move too far apart during transaction preventing situations where one player runs away during trade. Proximity check runs continuously during entire trade process.
Trade Logging: Complete transaction logs enable admins to investigate disputed trades, verify what was exchanged, identify scam attempts, and resolve conflicts with evidence. Logs include player identifiers, items traded, quantities, timestamps, and trade success/cancellation status.
Technical Specifications
- Performance: ~0.015ms server impact, optimized inventory operations and validation
- Database: Stores trade history with participant data, items exchanged, and transaction timestamps
- Inventory Systems: Compatible with ox_inventory, qb-inventory, qs-inventory, esx_inventory, and custom solutions
- UI Technology: Modern NUI interface with responsive design and real-time synchronization
- Security: Server-side validation of all operations preventing exploits and duplication
- File Size: Approximately 6 MB including UI assets, sound effects, and configuration
Installation
- Download the CodeM Trading Script package from your purchase confirmation
- Extract the resource to your server's resources directory
- Import the provided SQL file creating trade history database table
- Configure framework settings in config.lua (ESX/QBCore detection)
- Set up trade distance limits, confirmation timeouts, and cooldown periods
- Configure money transfer limits and blacklisted items
- Customize UI colors and positions to match server theme
- Add
ensure codem-tradingto server.cfg - Restart server and test trading between two players
- Verify all items transfer correctly with metadata preservation
Framework Compatibility
- ✅ ESX Legacy - Full integration with ESX inventory, money systems (cash/black money), and player data
- ✅ QBCore - Complete QB support with inventory metadata, cash handling, and player management
- ✅ QBOX - Compatible with modern QBOX framework features
- ✅ Standalone - Can operate with custom frameworks through inventory bridge configuration
Configuration Options
- Trade Distance: Set maximum distance between players to initiate and maintain trades (default: 3-5 meters)
- Confirmation Timeout: Countdown duration after both accept before execution (default: 3-5 seconds)
- Inactivity Timeout: Auto-cancel trades after X minutes of no activity (default: 2-5 minutes)
- Money Limits: Set minimum and maximum cash amounts per trade preventing micro-transactions or excessive transfers
- Trade Cooldown: Require X seconds between consecutive trades per player (optional, prevents spam)
- Blacklisted Items: Define items that cannot be traded (admin tools, quest items, special weapons)
- Sound Effects: Enable/disable audio feedback and customize sound files
- UI Customization: Adjust colors, positions, transparency, and styling to match server aesthetics
Trade History & Logging
Every completed trade is logged to database with comprehensive information including both player identifiers (license, steam, etc.), all items exchanged with quantities, money amounts transferred, exact timestamp, and trade success status. Admins can query trade history to investigate suspicious activity, resolve player disputes about missing items, track market activity and popular items, identify potential exploits or unusual patterns, and provide evidence for ban appeals or reports.
Optional Discord webhook integration sends real-time notifications of high-value trades (configurable threshold) helping admins monitor economy for manipulation or RMT (real money trading) attempts.
Integration Possibilities
- Shop Scripts: Business owners can trade inventory stock to their shops rather than using admin commands
- Job Systems: Facilitate job-to-job trading like mechanics buying parts from suppliers or chefs purchasing ingredients
- Gang Systems: Gang members trade weapons, drugs, or resources within organization
- Housing Scripts: Trade furniture items, property keys, or housing decorations between players
- Vehicle Scripts: Exchange vehicle ownership through trade system (if configured to support vehicle items)
- Crafting Systems: Players trade raw materials or crafted goods supporting production chains
What Makes It Stand Out
CodeM Trading Script eliminates the dangerous practice of drop trading where players drop items on ground hoping other player will pay. Drop trading is easily exploitable - players can run away with items, third parties can grab dropped items, or scammers can claim they never received goods. This script provides secure, transparent, simultaneous exchange where nobody can take items without giving agreed offerings. The real-time interface shows exactly what each player is offering before execution preventing bait-and-switch scams. The dual confirmation with countdown prevents rushed decisions. Most importantly, server-side validation makes exploits and duplication impossible creating trusted trading environment even on public servers.
Economy Enhancement
Secure trading enables genuine player-driven economy where players specialize in gathering, crafting, or reselling creating market dynamics. Resource gatherers sell raw materials to crafters who sell finished products to consumers establishing supply chains. Price discovery happens naturally through negotiation rather than fixed NPC prices. Trading creates social interaction - players must communicate, negotiate, and meet in-person rather than using impersonal auction houses. This generates organic roleplay and community building.
Use Case Examples
Merchant Roleplay: Player establishes marketplace stall and trades with customers using this system. Customers browse inventory, negotiate prices, and complete secure trades. Merchant tracks sales through trade history managing inventory turnover.
Drug Deals: Criminal sells drugs to another player through trade system. Both parties confirm quantities and payment before execution. If police interrupt, either can cancel trade instantly. No dropped evidence to collect.
Equipment Sales: Mechanic crafts vehicle parts and trades them to customers. Customer pays cash, receives parts, transaction complete. Mechanic has proof of sale in trade history if customer later disputes.
Resource Trading: Miner sells ore to crafter. Crafter processes into bars and sells to weaponsmith. Weaponsmith crafts guns and sells to gang members. Complete production chain facilitated by secure trading.
Admin Features
Server administrators have special controls including viewing complete trade history database, searching trades by player identifier, filtering by item type or value, exporting trade logs for analysis, identifying suspicious trading patterns, and optionally blocking specific players from trading (cooldown or blacklist). Admin panel provides insights into server economy including most traded items, average transaction values, and trading activity by time of day.
Support & Updates
Includes lifetime updates with new features, framework compatibility updates, security patches, and bug fixes. Comprehensive documentation covers installation, configuration, inventory system integration, troubleshooting, and best practices for economy management. Active support via ticket system for technical assistance and customization help. Regular updates add community-requested features like vehicle trading, trade templates, and advanced filtering.



