Skip to content

Spectating players break when target gets disconnected #735

Closed

Description

@xunder-matth

Spectating players will break when spectating target gets disconnected.

To reproduce this you need 3 players connected.
Commands I've used:

CMD:specon(playerid, params[]) {
    if (IsNull(params)) {
        return SendClientMessage(playerid, -1, "/specon [target id]");
    }

    new targetid = strval(params);

    if (!IsPlayerConnected(targetid)) {
        return SendClientMessage(playerid, -1, "Invalid target id");
    }

    SetPlayerInterior(playerid, GetPlayerInterior(targetid));
	SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));

	TogglePlayerSpectating(playerid, true);

	if (IsPlayerInAnyVehicle(targetid)) {
		PlayerSpectateVehicle(playerid, GetPlayerVehicleID(targetid));
	} else {
		PlayerSpectatePlayer(playerid, targetid);
	}
    return 1;
}

CMD:specoff(playerid, params[]) {
    TogglePlayerSpectating(playerid, false);
    return 1;
}
  1. Get 3 players on server (let's say ids are 0, 1 and 2)
  2. Player id 0: /specon 2 - this should be successful
  3. Disconnect player id 2 - this should cancel player's id 0 spectating state
  4. Try spectating player id 1 using player id 0 - this should fail

This bug is presented in v1-RC2 and 7b22bb036aafda001733649f67f5119ebf18b0cf

Bug is not presented in SA-MP server.

Activity

  1. added
    bug
    on Oct 10, 2023
  2. PazzOnee commented on Oct 10, 2023

    @PazzOnee

    Also to note, when do TogglePlayerSpectatig spectator to false, you again can spectate normaly

  3. AmyrAhmady commented on Oct 12, 2023

    @AmyrAhmady
    Member

    Fixed in #737

  4. PazzOnee commented on Oct 12, 2023

    @PazzOnee

    @AmyrAhmady Still not fixed in #737

  5. AmyrAhmady commented on Oct 13, 2023

    @AmyrAhmady
    Member

    Must now be fixed in #740

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions