SA-MP Forums Archive
needing Anti-Team Killing - 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: needing Anti-Team Killing (/showthread.php?tid=315413)



needing Anti-Team Killing - Maftaca - 03.02.2012

hi.. i need help.

i need something in my gamemode

i don't have gTeam, but i need to make Anti-Team Killing

I putted everything.. but didn't put anti-team killing

pls reply.. and help me!

but please help me!


Re: needing Anti-Team Killing - [HiC]TheKiller - 03.02.2012

SetPlayerTeam makes it so that you cant kill your own team .


Re: needing Anti-Team Killing - Maftaca - 03.02.2012

but i didn't set player team..


Re: needing Anti-Team Killing - MP2 - 03.02.2012

Set it then.


Re: needing Anti-Team Killing - Maftaca - 03.02.2012

Isn't there is a way doesn't let A player for example: If a player have a skin 107, he can not kill skin 106, not team System, do there is a way to?


Re: needing Anti-Team Killing - MP2 - 03.02.2012

Yes, use server-sided health with OnPlayerTakeDamage and deny the damage if a certain condition is met.


Re: needing Anti-Team Killing - Maftaca - 03.02.2012

well.. Give me something uh.. a pawn Code? With examples and etc? pls!! Pleaseeeeee


Re: needing Anti-Team Killing - MR.T[NL] - 03.02.2012

put this under OnPlayerDeath

Код:
if(gTeam[killerid] == gTeam[playerid]) {
            //punish him

	}



Re: needing Anti-Team Killing - Amit_B - 04.02.2012

Option #1, and recommended - using SetPlayerTeam.
Option #2 is as someone said above my post, you can detect TK in OnPlayerTake/GiveDamage, for example:
pawn Код:
// under OnPlayerGiveDamage
if(gTeam[killerid] == gTeam[playerid])
{
    new Float:h;
    GetPlayerHealth(damagedid,h);
    SetPlayerHealth(damagedid,h+amount);
}
I'm not really sure if it's gonna work well, but that's the basic code.