Bug: If you or the other player is not in a team, you can still share BP'sFixed

If one of you makes a team, you can't anymore as you're no longer in the "same team". Presumably it sees no team as valid if both players are in that state.

Sorry, the title should read, if you AND the other player are not in a team. ie, neither of you are in a team.

I think it's this section of code in ShareWithPlayer:

            if (!SameTeam(player, target) && !SameClan(playerID, targetID) && !AreFriends(playerID, targetID))
 

Thank you for reporting this issue I will look into it.

Ok, I think I fixed this by changing:

​
private bool SameTeam(BasePlayer player, BasePlayer target) => player.currentTeam == target.currentTeam;


to

        private bool SameTeam(BasePlayer player, BasePlayer target)
        {
            if (player.currentTeam == 0UL) return false;
            return player.currentTeam == target.currentTeam;
        }

I came to the same conclusion that players who weren't in teams had the same value so it looked like they were in the same team. I have not had a chance to test out the fix due to a lack of a testing partner but will hopefully have a patch out soon.

Merged post

I have updated the plugin with a fix to this problem.

Locked automatically