[How-to] Adapt your script to OneSync and fix your issues

Hello, I’m making this guide to summarize all the questions and issues that server owners faced/face with OneSync. This is an unofficial guide is made to help you and avoid dumb and useless questions that spammed the discord OneSync channel these past months. If your issue is not listed here, feel free to ask we might be able to help you and then update this guide.

Script issues and solutions

  • My scoreboard/player list is broken, my script does not find the player in front of me or PvP is disabled.
    You forgot to update your player loops. Since OneSync supports 128 players you need to update some parts of your code. Here are few examples:
    Using ESX you will need to change this:
    https://github.com/ESX-Org/es_extended/blob/master/config.lua#L13
    I strongly recommend you to put 256 instead of 31-32 (usually these numbers)
    Example of a lua function using a player loop
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 31 to 256.
Edit: elements added a new native to avoid useless call in this kind of loops, check this: GET_ACTIVE_PLAYERS: the replacement for player loops

  • The voice chat is not working, I hear everyone
    This is not an issue from onesync. However, you might need to set the initial voice range a little bit later than before. Here is a little snippet of a working fix:
-- 8.0 will be the default range, change it if you want
Citizen.CreateThread(function()
	NetworkSetTalkerProximity(8.0)
end)
  • Instance/Properties invisibility does not work
    This is because SetEntityLocallyInvisible and SetEntityLocallyVisible do not work as intended.
    A workable workaround is the use of SetEntityVisible instead of SetEntityLocallyInvisible in your script. A known script that uses this native: https://github.com/ESX-Org/instance/blob/master/client/main.lua#L226
    If this workaround does not work, then you forgot to update your loops.
  • I have an error in my console, related to ■■■■■■■
    “Failed to execute thread: Execution of native 000000002f7a49e6 in script host failed.”
    ■■■■■■■ uses a cfx native that is deprecated with OneSync. You have two solutions: disable ■■■■■■■ or use this untested fix https://github.com/citizenfx/cfx-server-data/pull/46/commits/18b8da8bb3ea3a97f719dbf4c44ce177329dc313
  • GCPhone is not working, I do not hear other peoples while in call
    Firstly, I recommend you to use the “WebRTC” feature of GCPhone the script should be working. properly. Otherwise, you might need to add a delay to prevent NetworkSetVoiceChannel being set at the same time (until the fix)
  • Lips are not moving
    Use this ugly little workaround : The OneSync EAP and you

Known issues of OneSync

  • Tatooes / Overlays are flickering
    PlayerAppearanceDataNode may not sync sometimes, this is being investigated.
  • Misc issues
    Certain vehicle gadgets (hooks/magnets) may not work as expected.
    Some natives might be broken like SetEntityVisible or NetworkCreateSynchronisedScene
  • Client crashes
    You might crash sometimes but it remains pretty rare. The most part of the remaining annoying crashes need reproduction steps to be fixed.

FAQ

  • I’ve seen some servers using 40-50 slots instead of 128 slots is it more stable?
    It is not true.
  • My server is crashing what should I do?
    In you are running Linux, then RIP.
    If you are running a Windows Server upload your crash dump (crashes folder) in the OneSync bugs hunting category.
  • How do I get the onesync access key?
    Make sure your FiveM forum email and Patreon email are the same. It can take up to 6 hours for synchronization upon which https://keymaster.fivem.net/ will say you are bestowed with bonuses. Any new and existing license keys will have these bonuses. If you are using ZAP hosting, you need to create a license key and enter this as “Custom license key” in the ZAP hosting control panel.
  • How to enable OneSync ?
    To enable onesync you firstly need to have access to it, read above. Then, to enable onesync add this convar in your *.cfg file. onesync_enabled 1 and obviously sv_maxClients 64 to increase slots.
  • I’m getting "OneSync is not whitelisted for this server"
    Read How do I get the onesync access key above.
    If you did everything correctly just wait, fivem services might have performance issues but this remains pretty rare. Do not worry about it.
  • I’m not interested by mumble, how can I disable it
    If you wanna get rid of it and disable it. Go to your fx-server folder, open components.json and remove voip-server-mumble. It will prevent FXServer from running this specific dll.

This part of the forum is dedicated to heavy/meaningful/useful/relevant OneSync’s reports: https://forum.cfx.re/c/general-discussion/1s-reports

23 Likes

Update

  • Added some hint for OneSync++
  • Remove fixed “issues”
  • Explain how to “disable” mumble
2 Likes

Hey,

What about ESX? For example, My cops can’t search anybody

2 Likes

If I “disable” mumble, I will not have IG voice ?

1 Like

Yes you will need another VOIP

1 Like

Check player loops line
" My scoreboard/player list is broken, my script does not find the player in front of me or PvP is disabled."

1 Like

Nice ! It’s exactly what I want. Thanks

1 Like

the users, are having access to the spectate and administrator menu.
I’m using es_admin2 and esx_spectate.Thank you

1 Like

while true do
for i = 1, #doorList do
local playerCoords = GetEntityCoords( GetPlayerPed(-1) )
if doorList[i][“ishash”] == 0 then
hash = GetHashKey(doorList[i][“objName”])
else
hash = doorList[i][“objName”]
end

I need to change this
for i = 1, #doorList do

   for i = 1, 256 #doorList do

?

1 Like

It is your loops, check above

1 Like

this is not a player loop

1 Like

On the original onesync post they say to change loops from 31 to 255, why u say 256? is better or soemthing?

1 Like

Read this OneSync+ and future work on OneSync @LIL_QK

1 Like

ok, thanks, ikm working on a 128 server, do you have discord? so if i need help or something

1 Like

@PichotM

Credits to @Sonnydg for the fix. This allows GCPhone to use the new mumble talk.

2 Likes

I have problem with transactions - everyone get “no player nearby”
why?
I set all loops to 255 :frowning:
Thanks for help

1 Like

Search for any player loops in this specific resource
Also if you are using ESX/ES you might need to specify “maxplayers” somewhere

1 Like

I don’t understand where to put this to solve the voice problem :confused:

– 8.0 will be the default range, change it if you want Citizen.CreateThread(function() NetworkSetTalkerProximity(8.0) end)

1 Like