Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove extra sanity check in setSpectating #745

Merged
merged 1 commit into from
Oct 18, 2023
Merged
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
16 changes: 1 addition & 15 deletions Server/Source/player_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,21 +606,6 @@ struct Player final : public IPlayer, public PoolIDProvider, public NoCopy

void setSpectating(bool spectating) override
{
NetCode::RPC::TogglePlayerSpectating togglePlayerSpectatingRPC;

// Reset internal player spectating data if ID is already set to a player
// Related issue: https://github.com/openmultiplayer/open.mp/issues/735
// UPD: Also send player spectating RPC to disable it first in client internally
if (spectating && spectateData_.type == PlayerSpectateData::ESpectateType::Player && spectateData_.spectateID != INVALID_PLAYER_ID)
{
spectateData_.type = PlayerSpectateData::ESpectateType::None;
spectateData_.spectateID = INVALID_PLAYER_ID;
spectateData_.spectating = false;

togglePlayerSpectatingRPC.Enable = spectateData_.spectating;
PacketHelper::send(togglePlayerSpectatingRPC, *this);
}

if (spectating == spectateData_.spectating)
{
return;
Expand All @@ -646,6 +631,7 @@ struct Player final : public IPlayer, public PoolIDProvider, public NoCopy
// Is called in here, which it shouldn't according to samp structure.
}

NetCode::RPC::TogglePlayerSpectating togglePlayerSpectatingRPC;
spectateData_.spectating = spectating;
togglePlayerSpectatingRPC.Enable = spectating;
PacketHelper::send(togglePlayerSpectatingRPC, *this);
Expand Down
Loading