From d59fbe0f67223a3a8abb4357526ce2aa75455a2f Mon Sep 17 00:00:00 2001 From: Revelts Date: Sun, 28 Jun 2026 18:31:57 +0700 Subject: [PATCH] fix npc put in vehicle not visually attaching for boats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vehicle::putPlayer only sends PutPlayerInVehicle to the entering player, which is a no-op for an NPC since it has no real client. Without an explicit broadcast, remote clients have no signal to visually attach the NPC and must rely on the next DriverSync — which some vehicles, notably boats (e.g. 595, 446), refuse to honour while the player is on-foot from their perspective. Mirror the natural goToVehicle flow by broadcasting EnterVehicle to streamed players inside NPC::putInVehicle. Fixes openmultiplayer/open.mp#1225 --- Server/Components/NPCs/NPC/npc.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Server/Components/NPCs/NPC/npc.cpp b/Server/Components/NPCs/NPC/npc.cpp index 0aab1c4ad..a9ca35701 100644 --- a/Server/Components/NPCs/NPC/npc.cpp +++ b/Server/Components/NPCs/NPC/npc.cpp @@ -1539,6 +1539,18 @@ bool NPC::putInVehicle(IVehicle& vehicle, uint8_t seat) vehicle_ = &vehicle; vehicleSeat_ = seat; + // Vehicle::putPlayer only sends PutPlayerInVehicle to the entering player, + // which is a no-op for an NPC (no real client to receive it). Without an + // explicit broadcast, remote clients have no signal to visually attach the + // NPC and must rely on the next DriverSync, which some vehicles (notably + // boats) refuse to honour while the player is on-foot. Mirror the natural + // goToVehicle flow by broadcasting EnterVehicle to streamed players. + NetCode::RPC::EnterVehicle enterVehicleRPC; + enterVehicleRPC.PlayerID = player_->getID(); + enterVehicleRPC.VehicleID = vehicle.getID(); + enterVehicleRPC.Passenger = (seat != 0) ? 1 : 0; + PacketHelper::broadcastToStreamed(enterVehicleRPC, *player_, true); + auto angle = vehicle.getRotation().ToEuler().z; auto rotation = getRotation().ToEuler(); rotation.z = angle;