What is OneSync in FiveM™?
OneSync is a workaround created by FiveM™ to provide the ability to play with more than 32 players in one session of your FiveM™ server hosting. GTA V / Rockstar has only 32 players in one session by default and does not support more than that.
To use OneSync, you need a Patreon subscription from CitizenFX.
How to Adapt Your Script?
If you want to start using OneSync on your FiveM™ server hosting and you notice that some of your scripts no longer work, this is because your scripts are not optimized for the use of OneSync. The reason for this is that these scripts were made before OneSync was released or because the creator of the script has chosen to work with a maximum of 32 players.
In order to optimize your scripts, you have to adjust player loops.
Below is a piece of code from es_extended v1.1.0 as an example. This is currently still used for ESX V1. Almost everything has already been optimized for ESX V2.
A player loop on your FiveM™ server hosting works as follows:
function GetPlayers()
local players = {}
for i = 0, 31 do
if NetworkIsPlayerActive(i) then
players[#players + 1] = i
end
end
return players
end
In this example, you will need to change:
for i = 0, 31 do
to for i = 0, 256 do
You can search and find player loops most of the time in a client file.
You should also always check the config files. In this case, for es_extended v1.1.0 you see a Config.MaxPlayers of 32. You can also change this to 256. That won’t matter if you have set fewer players.
Open es_extended/config.lua and change on line 13: Config.MaxPlayers = GetConvarInt('sv_maxclients', 32)
to Config.MaxPlayers = GetConvarInt('sv_maxclients', 256)
Facing Any Issues?
If you have followed all of the steps in this guide correctly, your script should work for your Server Hosting for FiveM™ from Iceline Hosting. If the script is not working and you have OneSync enabled, make sure your server has the right FiveM Element Club modification. If you are still having issues after this, feel free to contact Iceline Hosting support for further assistance.
Want to start your own FiveM™ server? Check out our Server Hosting for FiveM™ at Iceline Hosting.