Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions Server/Components/Vehicles/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,16 +809,7 @@ void Vehicle::destream()
{
vehicleData->setVehicle(nullptr, 0);
}

// Related issue: https://github.com/openmultiplayer/open.mp/issues/735
// Disable spectator's spectating state when spectated vehicle is removed
// This also makes spectateData values to be accurate and not remain with old data
auto spectateData = player->getSpectateData();
if (spectateData.type == PlayerSpectateData::ESpectateType::Vehicle && spectateData.spectateID == poolID)
{
player->setSpectating(false);
}


if (isStreamedInForPlayer(*player))
{
streamOutForClient(*player);
Expand Down
7 changes: 7 additions & 0 deletions Server/Source/player_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,13 @@ struct Player final : public IPlayer, public PoolIDProvider, public NoCopy
pos_ = target.getPosition();
target.streamInForPlayer(*this);

IPlayer* vdriver = target.getDriver();
// Stream vehicle driver immediately.
if (vdriver != nullptr)
{
vdriver->streamInForPlayer(*this);
}

spectateData_.type = PlayerSpectateData::ESpectateType::Vehicle;
spectateData_.spectateID = target.getID();

Expand Down