Skip to Content
ReferenceLimits

Limits

Understanding the technical limits of FiveM is crucial for server stability and performance.

OneSync & Player Limits

The limits depend heavily on whether OneSync is enabled (which is mandatory for modern servers).

FeatureNo OneSyncOneSync LegacyOneSync Infinity
Max Players321282048
Entity AwarenessGlobalGlobalDistance Culling (Scope)
Server LogicLimitedFullFull

Player Recommendations

  • Stable: 48-64 players is the “standard” baseline.
  • High Pop: 200-300 is common for well-optimized RP servers.
  • Extreme: 1000+ is possible but requires extreme optimization and specific game modes.

Entity Limits

GTA V has hard limits on how many entities of certain types can exist. OneSync Infinity helps bypass this by only telling clients about entities near them.

Global Pools (Approximate)

  • Peds: 256 (Client-side pool)
  • Vehicles: 64 (Client-side pool without OneSync)
  • Objects: 2048+
  • Pickups: ~70

Note: With OneSync Infinity, the server can track up to 65,535 entities, but a single client can only “see” (have loaded) the amounts listed above.

Resource & File Limits

Streaming Assets

  • Physical Memory: The game has a limit on loaded texture memory. Exceeding this causes “Texture Loss” (world disappearing).
  • File Size:
    • Keep individual .ytd (texture) files under 16MB (ideally <10MB).
    • Avoid massive .yDR (model) files.
  • Total Assets: No hard limit, but loading 10GB of cars will cause massive join lag and texture loss for players with weaker PCs.

Scripting

  • Lua Memory: Each resource has a memory limit (defaults around 64-128MB depending on settings). Memory leaks in loops can crash the resource.
  • KVP Storage: SetResourceKvp limits are typically around a few MBs per resource. Use a database (SQL) for real data.

Network Limits

Events

  • Rate Limit: Spamming server events can trigger DoS protection or “Reliable Network Event Overflow”.
  • Payload Size: Avoid sending huge tables (>50kb) in a single event. Chunk the data or use an HTTP export if necessary.

State Bags

  • Replication: State bags (Entity.state) are efficient but shouldn’t be used for high-frequency data (like RPM gauges updating 60 times a second).

Optimization Strategies

How to Check Usage

  1. Resmon: Open client console (F8) and type resmon 1.
    • CPU msec: Should be < 0.05ms for idle scripts.
    • Memory: Should be stable.
  2. Profiler: Use the profiler command in the server console to debug slow server frames.
  3. ETW Tracing: Advanced Windows tool for deep debugging.

Best Practices

  1. Distance Culling: Don’t draw markers or text for things 500m away.
  2. Asset Optimization: Resize textures. A T-Shirt doesn’t need a 4K texture; 512x512 is fine.
  3. Use OneSync Scope: On server-side, only trigger events for players in scope of the target, not -1 (all players).
  4. Model Loading: Always unload models (SetModelAsNoLongerNeeded) after spawning to free memory.

Framework Specifics

QBCore

  • Player Data: Stored in QBCore.Players. Heavy usage can increase server RAM.
  • Database: frequent MySQL.Sync calls block the main thread. Use MySQL.Async or await MySQL.query.

ESX

  • Legacy: Older versions had heavy “loops” for player checking. Ensure you use the latest Legacy version which uses OneSync features.
Last updated on