SA-MP Forums Archive
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: anti-teamkill (/showthread.php?tid=505560)



anti-teamkill - Extraordinariness - 09.04.2014

I am looking for good anti teamkill not anti team kill kick.
SetPlayerTeam doesn't work.
OPSP works, but when you spam it, he still reduces health.
I want something like TDM servers when you spam the enemy, he/she doesn't reduce health.
What is that secret?


Re: anti-teamkill - awsomedude - 09.04.2014

Try using OnPlayerWeaponShot
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
Note: They will still get hurt if its not a weapon that shoots.


Re: anti-teamkill - Extraordinariness - 09.04.2014

Okay, I'll try.
_________
Thanks man


Re: anti-teamkill - SickAttack - 09.04.2014

You can easily use SetPlayerTeam(playerid, id); to make an anti team kill.

Example:

pawn Код:
if(classid == 0)
{
   SetPlayerTeam(playerid, 1);
}
if(classid == 1)
{
   SetPlayerTeam(playerid, 1);
}
if(classid == 3)
{
   SetPlayerTeam(playerid, 255);
}
Class 1 and 2 can't kill each other, class 1 and 2 can kill class 3, class 3 can kill class 1 and 2.
255 = Null.


Re: anti-teamkill - Extraordinariness - 09.04.2014

Quote:
Originally Posted by Extraordinariness
Посмотреть сообщение
SetPlayerTeam doesn't work.
lol.


Re: anti-teamkill - SickAttack - 09.04.2014

Quote:
Originally Posted by Extraordinariness
Посмотреть сообщение
lol.
SetPlayerTeam works.

Yes it does, its not my fault you don't know how to use it in a proper way... Go get some scripting skills before placing false statements...


Re: anti-teamkill - Equuuuin0X - 09.04.2014

Put this ontop of your script.

pawn Код:
forward TeamProtection();
This under OnGameModeInIt()

pawn Код:
SetTimer("TeamProtection", 5000 ,true);
dis anywhere in your script, I'm using SetPlayerTeam yes, you said it didnt work, but I'm sure 100% this waay anti-teamkll style will work.

pawn Код:
public TeamProtection()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SetPlayerTeam(i, gTeam[i]);
        }
    }
}