From bc135c02b404d4eddb0e0bb35968b148eb8443b9 Mon Sep 17 00:00:00 2001 From: "Berk L." Date: Sun, 19 Apr 2026 15:58:15 +0300 Subject: [PATCH 1/2] fix: reset paintjob on vehicle respawn Vehicle paintjob was not being cleared in _respawn() while all other modifications (mods, colours, damage) were properly reset, causing the paintjob to persist after vehicle respawn. Fixes #1212 --- Server/Components/Vehicles/vehicle.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Server/Components/Vehicles/vehicle.cpp b/Server/Components/Vehicles/vehicle.cpp index be6ab215c..836cb417d 100644 --- a/Server/Components/Vehicles/vehicle.cpp +++ b/Server/Components/Vehicles/vehicle.cpp @@ -707,6 +707,7 @@ void Vehicle::_respawn() lastOccupiedChange = TimePoint(); timeOfSpawn = Time::now(); mods.fill(0); + paintJob = 0; doorDamage = 0; tyreDamage = 0; lightDamage = 0; From 9b474e40e7e51002111a993a911ca81f5a1d09b0 Mon Sep 17 00:00:00 2001 From: "Berk L." Date: Sun, 19 Apr 2026 16:30:32 +0300 Subject: [PATCH 2/2] fix: move SeedCookie after rakNetServer.Start() to prevent connection failures RakPeer::Start() internally calls RakPeer::Disconnect() which resets RakNet internal state. SeedCookie() was called before Start(), meaning the seeded cookie was discarded. Clients connecting in the window between server start and the first onTick() re-seed would fail cookie validation and have their packets silently ignored (issue #1211). Also adds an explanatory comment to the paintjob reset fix. --- .../Components/LegacyNetwork/legacy_network_impl.cpp | 10 ++++++++-- Server/Components/Vehicles/vehicle.cpp | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Server/Components/LegacyNetwork/legacy_network_impl.cpp b/Server/Components/LegacyNetwork/legacy_network_impl.cpp index 3cbe91088..354d182da 100644 --- a/Server/Components/LegacyNetwork/legacy_network_impl.cpp +++ b/Server/Components/LegacyNetwork/legacy_network_impl.cpp @@ -828,8 +828,6 @@ void RakNetLegacyNetwork::start() { SAMPRakNet::Init(core); SAMPRakNet::SeedToken(); - lastCookieSeed = Time::now(); - SAMPRakNet::SeedCookie(); playerFromRakIndex.fill(nullptr); @@ -915,6 +913,14 @@ void RakNetLegacyNetwork::start() { rakNetServer.ReserveSlots(npcComponent->count()); } + + // SeedCookie must be called after rakNetServer.Start() because Start() internally calls + // RakPeer::Disconnect() which resets RakNet's internal state. Seeding the cookie before + // Start() means the seeded value is discarded, leaving the cookie in an invalid state + // until the next onTick() re-seed. Clients connecting in that window fail the cookie + // check and their packets are silently ignored (issue #1211). + lastCookieSeed = Time::now(); + SAMPRakNet::SeedCookie(); } void RakNetLegacyNetwork::onTick(Microseconds elapsed, TimePoint now) diff --git a/Server/Components/Vehicles/vehicle.cpp b/Server/Components/Vehicles/vehicle.cpp index 836cb417d..9eaebd407 100644 --- a/Server/Components/Vehicles/vehicle.cpp +++ b/Server/Components/Vehicles/vehicle.cpp @@ -707,6 +707,7 @@ void Vehicle::_respawn() lastOccupiedChange = TimePoint(); timeOfSpawn = Time::now(); mods.fill(0); + // paintJob was not reset here unlike mods and colours, causing it to persist after vehicle respawn (issue #1212) paintJob = 0; doorDamage = 0; tyreDamage = 0;