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).
| Feature | No OneSync | OneSync Legacy | OneSync Infinity |
|---|---|---|---|
| Max Players | 32 | 128 | 2048 |
| Entity Awareness | Global | Global | Distance Culling (Scope) |
| Server Logic | Limited | Full | Full |
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.
- Keep individual
- 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:
SetResourceKvplimits 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
- Resmon: Open client console (
F8) and typeresmon 1.- CPU msec: Should be < 0.05ms for idle scripts.
- Memory: Should be stable.
- Profiler: Use the
profilercommand in the server console to debug slow server frames. - ETW Tracing: Advanced Windows tool for deep debugging.
Best Practices
- Distance Culling: Don’t draw markers or text for things 500m away.
- Asset Optimization: Resize textures. A T-Shirt doesn’t need a 4K texture; 512x512 is fine.
- Use OneSync Scope: On server-side, only trigger events for players in scope of the target, not
-1(all players). - 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.Synccalls block the main thread. UseMySQL.Asyncorawait 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