diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 24c9ff6edc..ce44a7d79a 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -10852,26 +10852,35 @@ bool CStaticFunctionDefinitions::ResetMoonSize() bool CStaticFunctionDefinitions::SendSyncIntervals(CPlayer* pPlayer) { - CBitStream BitStream; - BitStream.pBitStream->Write(g_TickRateSettings.iPureSync); - BitStream.pBitStream->Write(g_TickRateSettings.iLightSync); - BitStream.pBitStream->Write(g_TickRateSettings.iCamSync); - BitStream.pBitStream->Write(g_TickRateSettings.iPedSync); - BitStream.pBitStream->Write(g_TickRateSettings.iUnoccupiedVehicle); - BitStream.pBitStream->Write(g_TickRateSettings.iObjectSync); - BitStream.pBitStream->Write(g_TickRateSettings.iKeySyncRotation); - BitStream.pBitStream->Write(g_TickRateSettings.iKeySyncAnalogMove); - - if (pPlayer->CanBitStream(eBitStreamVersion::FixSyncerDistance)) + auto sendSyncIntervalPatket = [](CPlayer* pPlayer) { - BitStream.pBitStream->Write(g_TickRateSettings.iPedSyncerDistance); - BitStream.pBitStream->Write(g_TickRateSettings.iUnoccupiedVehicleSyncerDistance); - } + CBitStream BitStream; + BitStream.pBitStream->Write(g_TickRateSettings.iPureSync); + BitStream.pBitStream->Write(g_TickRateSettings.iLightSync); + BitStream.pBitStream->Write(g_TickRateSettings.iCamSync); + BitStream.pBitStream->Write(g_TickRateSettings.iPedSync); + BitStream.pBitStream->Write(g_TickRateSettings.iUnoccupiedVehicle); + BitStream.pBitStream->Write(g_TickRateSettings.iObjectSync); + BitStream.pBitStream->Write(g_TickRateSettings.iKeySyncRotation); + BitStream.pBitStream->Write(g_TickRateSettings.iKeySyncAnalogMove); + + if (pPlayer->CanBitStream(eBitStreamVersion::FixSyncerDistance)) + { + BitStream.pBitStream->Write(g_TickRateSettings.iPedSyncerDistance); + BitStream.pBitStream->Write(g_TickRateSettings.iUnoccupiedVehicleSyncerDistance); + } - if (pPlayer) pPlayer->Send(CLuaPacket(SET_SYNC_INTERVALS, *BitStream.pBitStream)); + }; + + + if (pPlayer) + sendSyncIntervalPatket(pPlayer); else - m_pPlayerManager->BroadcastOnlyJoined(CLuaPacket(SET_SYNC_INTERVALS, *BitStream.pBitStream)); + { + for (auto iter = m_pPlayerManager->IterBegin(); iter != m_pPlayerManager->IterEnd(); ++iter) + sendSyncIntervalPatket(*iter); + } return true; }