Cops and Robbers ‐ FiveM Game Mode - Indom-hub/Cops-and-Robbers GitHub Wiki

Welcome to the Cops and Robbers game mode Wiki! This open-source FiveM game mode provides an immersive GTA V roleplay experience, focusing on the dynamic and strategic interaction between law enforcement and criminal factions. This guide will walk you through setting up, configuring, and managing the game mode.


Table of Contents

  1. Overview
  2. Installation
  3. Gameplay Guide
  4. Controls and Keybinds
  5. Store and Inventory System
  6. Administrative Commands
  7. User Interface Guide
  8. File Structure
  9. Advanced Configuration Tips
  10. Command List
  11. Troubleshooting
  12. Contributing
  13. License

Overview

Cops and Robbers is designed for high-engagement roleplay servers on FiveM. Players are divided into three main roles:

  • Cops: Tasked with arresting robbers, preventing crime, maintaining law and order in Los Santos, and using specialized equipment like spike strips and armor.
  • Robbers: Responsible for executing heists, evading law enforcement, completing various criminal objectives, and managing illegal activities.
  • Civilians: Can participate in the economy, banking system, and general roleplay activities without the restrictions of law enforcement or criminal roles.

Key Features

  • Dynamic Role System: Players can choose from Cop, Robber, or Civilian roles with unique abilities and restrictions
  • Advanced Inventory System: Modern UI with category-based navigation and real-time item management
  • Multiple Store Types: Cop stores, robber stores, gun shops, and general stores with role-specific access
  • Banking & Heist System: Comprehensive financial system with bank robberies and economic gameplay
  • Equipment Management: Weapon wheel integration, armor system, medical items, and cop-specific gear
  • Administrative Tools: Extensive admin commands for server management and player control
  • Crime Tracking: Wanted levels, pursuit mechanics, and law enforcement response systems

Installation

Step 1: Download & Extract Files

Ensure all required files are downloaded:

  • Core Scripts: client.lua, server.lua, inventory_server.lua, admin.lua, config.lua
  • Manifest: fxmanifest.lua
  • Web Interface: html/index.html, html/styles.css, html/scripts.js

Place these files into a folder named Cops-and-Robbers within your FiveM server's resources directory.

Step 2: Server Configuration

In your server.cfg file, add the following line:

ensure Cops-and-Robbers

This command activates the resource on server startup.

Step 3: Verify fxmanifest.lua Setup

The manifest includes all necessary dependencies:

  • NUI interface components
  • All client and server scripts
  • HTML, CSS, and JavaScript files

Step 4: Customize Configurations

Modify config.lua to adjust:

  • Item prices and availability
  • Store locations and types
  • Role-specific restrictions
  • Economic balance settings
  • Administrative permissions

Gameplay Guide

Role Selection

  1. Accessing the Role Menu:

    • Upon joining the server, players see a role selection interface
    • Options include: Cop, Robber, and Civilian
    • Each role has unique abilities, restrictions, and objectives
  2. Role-Specific Features:

    • Cops: Access to police equipment, spike strips, arrest mechanics, and law enforcement stores
    • Robbers: Criminal activities, heist participation, and access to illegal goods
    • Civilians: General gameplay, banking, shopping, and roleplay activities

Player Inventory System

NEW FEATURE: The inventory system now includes a modern, user-friendly interface accessible via the I key.

  1. Opening Inventory:

    • Press I to open the inventory interface
    • Available for cops and robbers (civilians have limited access)
  2. Inventory Features:

    • Category Filtering: Filter items by type (All, Weapons, Armor, Utility, Medical, etc.)
    • Item Management: Equip, use, or drop items with confirmation dialogs
    • Equipment Panel: View currently equipped weapons and gear
    • Real-time Updates: Inventory syncs automatically with game actions
  3. Item Actions:

    • Equip: Add weapons to weapon wheel or equip armor
    • Use: Consume medical items, deploy spike strips, or activate special equipment
    • Drop: Remove items from inventory with confirmation

Store System

Multiple store types are available throughout Los Santos:

  1. Cop Stores:

    • Located at police stations
    • Sell law enforcement equipment, armor, weapons, and medical supplies
    • Restricted to police officers only
  2. Robber Stores:

    • Hidden locations for criminal equipment
    • Illegal weapons, lockpicks, and criminal tools
    • Restricted to robbers only
  3. Gun Shops:

    • Public weapon stores (Ammu-Nation locations)
    • Basic firearms and ammunition
    • Available to all roles with restrictions
  4. General Stores:

    • Basic supplies and civilian items
    • Food, drinks, and general equipment
    • Open to all players

Heist Mechanics

  1. Bank Heists:

    • Coordinated criminal activities with timer-based objectives
    • Multiple bank locations with varying difficulty and rewards
    • Team-based gameplay requiring planning and execution
  2. Heist Timer System:

    • Real-time countdown with visual HUD elements
    • Automatic completion/failure based on timer expiration
    • Dynamic police response based on heist progress

Banking System

  1. ATM Access:

    • Deposit and withdraw money
    • Account balance management
    • Transaction history (if implemented)
  2. Bank Interactions:

    • Traditional banking services
    • Targets for heist activities
    • Economic gameplay elements

Crime System

  1. Wanted Levels:

    • Dynamic wanted system based on criminal activities
    • Police response scaling with crime severity
    • Pursuit mechanics and escape scenarios
  2. Arrest Mechanics:

    • Police can arrest criminals
    • Jail time and fine systems
    • Release mechanisms and bail options

Controls and Keybinds

General Controls

  • I: Open/Close Player Inventory
  • E: Interact with stores, ATMs, and objects
  • ESC: Close any open UI interface
  • ENTER: Confirm actions and selections

Role-Specific Controls

  • Cops:

    • Access to spike strip deployment
    • Arrest mechanics and handcuffs
    • Police radio and communication systems
  • Robbers:

    • Lockpicking interactions
    • Heist-specific controls
    • Criminal activity interfaces

Store Controls

  • Mouse Navigation: Browse items and categories
  • Click to Select: Choose items for purchase or sale
  • Quantity Inputs: Adjust item amounts before transactions
  • Tab Switching: Navigate between Buy and Sell interfaces

Store and Inventory System

Accessing Stores

  1. Store Locations:

    • Marked on the map with appropriate icons
    • Role-specific access controls
    • Different store types for different purposes
  2. Store Interface:

    • Buy Tab: Purchase items with category filtering
    • Sell Tab: Sell inventory items for cash
    • Real-time price updates and inventory validation

Player Inventory

The new inventory system provides comprehensive item management:

  1. Inventory Categories:

    • Weapons: Firearms, melee weapons, and ammunition
    • Armor: Body armor, heavy armor, and protective gear
    • Medical: Medkits, first aid kits, and healing items
    • Utility: Tools, equipment, and special items
    • Food/Drinks: Consumable items for health/hunger
  2. Visual Interface:

    • Grid-based layout with item icons
    • Quantity indicators and item descriptions
    • Equipment status and durability (if applicable)

Item Management

  1. Equipment System:

    • Automatic weapon wheel integration
    • Armor application and protection values
    • Medical item consumption with health restoration
  2. Special Items:

    • Spike Strips: Deployable road hazards for cops
    • Lockpicks: Breaking and entering tools for robbers
    • Radio Equipment: Communication devices
    • Evidence: Crime scene items and investigation tools

Equipment System

  1. Weapon Management:

    • Equip weapons to add them to the weapon wheel
    • Ammunition tracking and reloading
    • Weapon-specific attachments and modifications
  2. Armor System:

    • Body armor provides damage reduction
    • Heavy armor for increased protection
    • Armor degradation over time and damage
  3. Medical System:

    • First aid kits for minor healing
    • Medkits for major health restoration
    • Emergency medical supplies for critical situations

Administrative Commands

Comprehensive admin tools for server management:

Player Management

Command Description Usage
/kick Remove a player from the server /kick <playerID>
/ban Permanently ban a player /ban <playerID>
/freeze Toggle player movement freeze /freeze <playerID>
/spectate Enter spectator mode for a player /spectate <playerID>
/teleport Teleport to a player's location /teleport <playerID>

Economy Management

Command Description Usage
/setcash Set a player's cash amount /setcash <playerID> <amount>
/addcash Add cash to a player's balance /addcash <playerID> <amount>
/removecash Remove cash from a player /removecash <playerID> <amount>

Role and Inventory Management

Command Description Usage
/setrole Assign a specific role to a player /setrole <playerID> <role>
/resetrole Reset player role to civilian /resetrole <playerID>
/giveitem Give items to a player /giveitem <playerID> <item> <amount>
/removeweapon Remove weapons from a player /removeweapon <playerID> <weapon>
/setinventory Set specific inventory quantities /setinventory <playerID> <item> <amount>

Health and Status

Command Description Usage
/heal Fully heal a player /heal <playerID>
/revive Revive a downed player /revive <playerID>

Event Management

Command Description Usage
/startheist Initiate a bank heist event /startheist <bank>
/stopheist End the current heist /stopheist

User Interface Guide

Role Selection UI

  • Clean, modern interface with role descriptions
  • Visual role indicators and ability previews
  • Confirmation dialogs for role changes
  • Styled with responsive design principles

Inventory Interface

NEW: Complete inventory overhaul with modern design:

  1. Main Interface:

    • Tabbed category system for easy navigation
    • Grid layout with item icons and quantities
    • Search and filter capabilities
    • Equipment panel showing active gear
  2. Item Actions Panel:

    • Context-sensitive action buttons
    • Item descriptions and statistics
    • Confirmation dialogs for important actions
    • Real-time feedback and notifications

Store Interfaces

  1. Buy Interface:

    • Category-based item browsing
    • Price display and quantity selection
    • Purchase confirmation and validation
    • Real-time cash balance updates
  2. Sell Interface:

    • Inventory item display with sell values
    • Bulk selling options and quantity controls
    • Transaction confirmation and processing
    • Market value indicators

HUD Elements

  1. Heist Timer:

    • Prominent countdown display
    • Target location and objective information
    • Progress indicators and status updates
  2. Role Indicators:

    • Current role display and status
    • Wanted level indicators (for criminals)
    • Health, armor, and cash displays

File Structure

Cops-and-Robbers/
├── fxmanifest.lua          # Resource manifest and dependencies
├── config.lua              # Configuration settings and item definitions
├── client.lua              # Client-side game logic and interactions
├── server.lua              # Server-side player data and economy
├── inventory_server.lua    # Inventory system server logic
├── admin.lua               # Administrative commands and tools
├── html/
│   ├── index.html          # Main UI interface
│   ├── styles.css          # Interface styling and animations
│   └── scripts.js          # Client-side UI logic and interactions
└── docs/
    └── README.md           # This documentation file

File Purposes

File Purpose
fxmanifest.lua Resource configuration and dependency management
config.lua Item definitions, prices, and gameplay settings
client.lua Player interactions, UI management, and client events
server.lua Player data management, economy, and server events
inventory_server.lua Inventory system logic and item management
admin.lua Administrative commands and server management tools
html/index.html Main user interface and component structure
html/styles.css UI styling, animations, and responsive design
html/scripts.js Frontend logic, event handling, and UI interactions

Advanced Configuration Tips

Economy Balancing

  1. Item Pricing:

    • Adjust prices in config.lua based on server economy
    • Consider role-specific pricing strategies
    • Balance risk vs. reward for criminal activities
  2. Store Configuration:

    • Customize store locations and access permissions
    • Modify item availability by role and location
    • Set up dynamic pricing systems

Gameplay Customization

  1. Role Permissions:

    • Fine-tune role-specific abilities and restrictions
    • Customize equipment access by role
    • Adjust crime and punishment systems
  2. Inventory Management:

    • Configure item stack sizes and limits
    • Set up item durability and degradation
    • Customize equipment effects and bonuses

Performance Optimization

  1. Server Resources:

    • Monitor inventory sync frequency
    • Optimize UI update intervals
    • Configure appropriate player limits
  2. Client Performance:

    • Adjust UI render distance and quality
    • Optimize texture loading and caching
    • Configure appropriate graphics settings

Command List

Admin Commands

Command Arguments Purpose
/startheist <bank> Start a heist at specified bank location
/stopheist None Stop the current heist event
/setrole <playerID> <role> Assign cop/robber/civilian role
/giveitem <playerID> <item> <amount> Give items to players
/setcash <playerID> <amount> Set player cash amount

Player Commands

Command Arguments Purpose
/inventory None Open inventory interface (alternative to I key)
/balance None Check current cash balance
/role None Display current role and status

Troubleshooting

Common Issues

  1. Inventory Not Opening:

    • Ensure player has cop or robber role
    • Check for UI focus conflicts with other resources
    • Verify I key is not bound to other functions
    • Restart the resource if inventory becomes unresponsive
  2. Store Access Problems:

    • Verify player role permissions
    • Check store location coordinates
    • Ensure proper role assignment
    • Confirm store type matches player role requirements
  3. Item Functionality Issues:

    • Weapons not appearing in weapon wheel after equipping
    • Medical items not providing health restoration
    • Armor not applying protection values
    • Spike strips not deploying properly
  4. Performance Issues:

    • High server lag during inventory operations
    • UI rendering slowly or inconsistently
    • Memory usage increasing over time

Solutions

  1. Permission Issues:

    -- Check player role assignment
    /setrole [playerID] [cop/robber/civilian]
  2. Resource Conflicts:

    • Disable conflicting inventory resources
    • Check for duplicate keybind assignments
    • Verify ESX compatibility settings
  3. Database Problems:

    • Ensure proper database permissions
    • Check inventory table structure
    • Verify player data synchronization

Contributing

We welcome contributions from the community!

Development Guidelines

  1. Code Standards:

    • Follow Lua best practices
    • Use consistent naming conventions
    • Include comprehensive comments
    • Test thoroughly before submission
  2. Feature Development:

    • Create feature branches for new development
    • Maintain backward compatibility when possible
    • Document new features and changes
    • Include configuration options for customization
  3. Bug Reports:

    • Provide detailed reproduction steps
    • Include server logs and error messages
    • Specify FiveM versions
    • Test with minimal resource conflicts

Contribution Process

  1. Fork the repository on GitHub
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Commit your changes: git commit -am "Description of changes"
  4. Push to your branch: git push origin feature/your-feature-name
  5. Create a pull request with detailed description of changes

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

License Summary

  • Commercial use allowed
  • Modification and distribution permitted
  • Private use allowed
  • Source code must remain open
  • Same license must be used for derivatives
  • Copyright and license notices must be preserved

Support and Community

Thank you for using Cops and Robbers!

Get Help

  • 🐛 Bug Reports: GitHub Issues
  • 💬 Community Support: Discord Server
  • 📖 Documentation: This wiki and inline code comments
  • 🔧 Feature Requests: GitHub Issues with enhancement label

Stay Updated

  • Star the repository to show support
  • 👀 Watch for updates and new releases
  • 🔄 Follow development in the Discord community
  • 📢 Share feedback to help improve the gamemode

Version: 1.2.0 | Last Updated: June 2025 | FiveM Compatibility: Latest

⚠️ **GitHub.com Fallback** ⚠️