[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

  • Unable to delete a vehicle, enter a vehicle or ghost vehicles
    This is a migration issue, for some reason the migration of this vehicle failed you can’t do anything to fix it yourself. In order to find a fix, you would need to provide logs that might provide enough info for the elements to fix it.
  • Weird vehicle spawning/cargen
    This is being investigated and cannot be fixed by you if the traffic is enabled.
  • Vehicle "despawn"
    Distance culling has been improved but set-as-mission-entity is still ignored.
    It can be fixed by a script that check if a vehicle has been removed. However, it remains complex and needs some knowledge to do something smoothly.
  • Tatooes / Overlays are flickering
    PlayerAppearanceDataNode may not sync sometimes, this is being investigated.
  • I see my corpse once I die
    This is being investigated and cannot be fixed by you.
  • Misc issues
    Sticky bombs are unlikely to work properly.
    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 synchronisation 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.
  • My F8 console is getting spammed by "passing object:*"
    This is just logs, 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.fivem.net/c/general-discussion/1s-reports

12 Likes

Update

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

Hey,

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

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

Yes you will need another VOIP

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."

Nice ! It’s exactly what I want. Thanks

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

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

?

It is your loops, check above

this is not a player loop

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

Read this OneSync+ and future work on OneSync @LIL_QK

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

@PichotM

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

1 Like

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

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

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)