Flood Teams confusion

Basically, we have a sort of team system where the round will end if only everyone on your Prop Protection is still alive and it will split the money. This is the code

[lua]
function FoundWinner()
if TimerStatus != 3 then return end
local Everyone = player.GetAll()
local Alive = GetAliveCount()
local alive_idents = {1,2,3,5,7,8,9}
local alive_players = {}
for _, i in pairs(alive_idents) do
local players_in_group = team.GetPlayers(i) or nil
if players_in_group != nil then
for _, p in pairs(players_in_group) do
table.insert(alive_players, p)
end
end
end
local buddies = false
for i=1, #alive_players do
for j=1, #alive_players do
if alive_players[j]:SteamID() == alive_players*:SteamID() then continue end
buddies = table.HasValue(alive_players[j].Buddies, alive_players*:SteamID()) or false
end
end
if (Alive <= 4 and buddies) or Alive == 1 then
TimerStatus = 4
RemoveAllWeapons()
ResetHealth()
LowerWater()
RecieveBonus()
GivePhysGuns()
for _, v in pairs(Everyone) do
– v:AddCount( “props”, 0 )
if v:Team() == TEAM_SPECTATOR then return end
if !v:Alive() then
v:AddLoss()
else
v:AddFrags(1)
v:AddWin()
end
v:SaveCash()
end
FightTime = FIV
end
end
[/lua]

Now the problem is, I had 1 other person on my team (prop protection) and the other team had 3 people. When my team mate died the round ended and split $2000 between the 4 people left alive even tho I wasn’t on there team. Afaik this only happens when there is a team of 3 from what I have seen anyway.

The only problem I can see is
[lua]if (Alive <= 4 and buddies) or Alive == 1 then[/lua]
or buddies being wrong somehow.

Thanks.

although its annoying, bots can be kind of helpful in testing if you dont have live players.

and your problem is a little obvious

buddies should be set on the player or something similar because what its doing is declaring buddies.

after is been declared it will have a boolean value of true.

which means that Alive <= 4 and buddies will evaluate to true and split the money.

my suggestion is making the player have a list of buddies (ie _R.Player.Buddies = {}) and add the buddies to that.

(sorry if this doesnt make much sense, im not too good with explaining things)