Teamkilling - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Teamkilling (
/showthread.php?tid=209219)
Teamkilling -
John_F - 10.01.2011
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?
Re: Teamkilling -
JaTochNietDan - 10.01.2011
Use
SetPlayerTeam.
They will not be able to damage each other if they are on the same team.
Re: Teamkilling -
Grim_ - 10.01.2011
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.
Re: Teamkilling -
John_F - 10.01.2011
@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.
Re: Teamkilling -
JaTochNietDan - 10.01.2011
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.
Re: Teamkilling -
John_F - 10.01.2011
So everytime someone logs in, I loop through all the people, get their team then set their team again?
Re: Teamkilling -
JaTochNietDan - 10.01.2011
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.
Re: Teamkilling -
John_F - 10.01.2011
Alright, thanks for your help.