Skip to content

Commit

Permalink
disable spectating when spectated vehicle is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Oct 14, 2023
1 parent 2e184f0 commit da79040
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Server/Components/Vehicles/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,15 @@ 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

0 comments on commit da79040

Please sign in to comment.