SA-MP Forums Archive
Team kill - 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: Team kill (/showthread.php?tid=413083)



Team kill - DerickClark - 04.02.2013

How to make Team kill? if a player on the same team can lost health.by team killing.


Respuesta: Team kill - Parka - 04.02.2013

pawn Код:
#include a_samp

new gTeam[MAX_PLAYERS]; ///define 0 and 1 the team
new Kills[MAX_PLAYERS];



public OnPlayerDeath(playerid, killeird, reason)
{
    if(gTeam[killeird] == gTeam[playerid] )
   {
   Kills[killeird]--;
   SetPlayerHealth(killerid, 0);
   } else { Kills[killeird]++; }

    return 1;
}

or use

SetPlayerTeam
SetTeamCount


Re: Team kill - DerickClark - 04.02.2013

Код:
C:\Users\(967) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Team kill - GWX - 04.02.2013

Cesars's code fixed, try this:
Код:
#include a_samp

new gTeam[MAX_PLAYERS]; ///define 0 and 1 the team
new Kills[MAX_PLAYERS];



public OnPlayerDeath(playerid, killerid, reason)
{
    if(gTeam[killerid] == gTeam[playerid]){
		Kills[killerid]--;
   		SetPlayerHealth(killerid, 0);
   	}
    else {
		Kills[killerid]++;
	}

    return 1;
}