Teamkilling
#1

After some searching, I've found a way to prevent teammates from KILLING each other but I need a way to prevent a person on a team from doing damage to a teammate's armor.
Is there anyway to do that atm?
Reply
#2

Use SetPlayerTeam.

They will not be able to damage each other if they are on the same team.
Reply
#3

Despite SetPlayerTeam's purpose of not allowing members of the same team to damage each other, it is very buggy. I'm not sure why, but the following code in a timer a few seconds after the player has spawned will prevent the bug from occurring.
pawn Код:
SetTeams( playerid )
{
   SetPlayerTeam( playerid, GetPlayerTeam( playerid ) );
   return 1;
}
It sets the team accordingly, but it never actually prevents from harming, or getting harmed, from other teammates. For some reason, after applying the function again, it fixes the issue.
Reply
#4

@JaTochNietDan: SetTeam is what I have been using, but as Grim_ pointed out, it was buggy in that it still allowed team members to harm each other (well, everytime I tested it it did anyway)

@Grim_ Thank you, I will test that tomorrow.
Reply
#5

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Despite SetPlayerTeam's purpose of not allowing members of the same team to damage each other, it is very buggy. I'm not sure why, but the following code in a timer a few seconds after the player has spawned will prevent the bug from occurring.
pawn Код:
SetTeams( playerid )
{
   SetPlayerTeam( playerid, GetPlayerTeam( playerid ) );
   return 1;
}
It sets the team accordingly, but it never actually prevents from harming, or getting harmed, from other teammates. For some reason, after applying the function again, it fixes the issue.
I believe that this error only occurs when someone connects to the server, so in order to fix this bug, you need to use SetPlayerTeam on everyone in the server each time someone connects.
Reply
#6

So everytime someone logs in, I loop through all the people, get their team then set their team again?
Reply
#7

That's the fix that I've been aware of anyway for years. I've never heard of a different fix really. I does seem to work fine though.
Reply
#8

Alright, thanks for your help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)