SA-MP Forums Archive
How to make anti-teamkill ? - 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)
+--- Thread: How to make anti-teamkill ? (/showthread.php?tid=409659)



How to make anti-teamkill ? - maho422 - 22.01.2013

I have a cnr server and all , cops , cia ,army ,fbi , swat are shoting each other , how can i make so they cant do that?

And how can i make so cops cant shot white people ? I mean so they cant damage each otehr


Re: How to make anti-teamkill ? - Jeffry - 22.01.2013

https://sampwiki.blast.hk/wiki/SetPlayerTeam


Re: How to make anti-teamkill ? - DaRk_RaiN - 22.01.2013

Well you can set the teams when the players spawn, it will stop the team kills.
Or if you use gTeam use the CallBacks OnPlayerTakeDamage and OnPlayerGiveDamage.


Re: How to make anti-teamkill ? - EpicNinja - 22.01.2013

Even if you use gTeam, you have to use SetPlayerTeam too! that's important for setting up a team rather then using useless callbacks and wasting codes.


Re: How to make anti-teamkill ? - Jewell - 22.01.2013

if you are using gTeam. then put this to your gamemode
basically..
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{

    if (gTeam[playerid] == gTeam[damagedid] && amount > 5)
    {
     
         SetPlayerArmedWeapon(playerid, 0);
         GameTextForPlayer(playerid,"~W~TEAM KILL is NOT allowed",2000,3);
     
     
    }
   
    return 0;
}
improve this yourself