10.11.2012, 06:34
Here's it
pawn Код:
new team1[MAX_PLAYERS], team2[MAX_PLAYERS]; //Creating two team global variables.
public OnPlayerTakeDamage(playerid, issueried, Float:amount, weaponid)
{
if(Team1[issuerid] == 1 && Team1[playerid] == 1) //If issuer and the player is in same team.
{
new Float:hp[MAX_PLAYERS];
GetPlayerHealth(playerid, hp[playerid]);
SetPlayerHealth(playerid, hp[playerid]); //So, here it gives balance and the player won't die.
}
else if(Team2[issuerid] == 1 && Team2[playerid] == 1) //If issuer and the player is in same team.
{
new Float:hp[MAX_PLAYERS];
GetPlayerHealth(playerid, hp[playerid]);
SetPlayerHealth(playerid, hp[playerid]); //So, here it gives balance and the player won't die.
}
return 1;
}
public OnPlayerUpdate(playerid)
{
if(Team1[playerid] == 1) return Team2[playerid] = 0;
if(Team2[playerid] == 1) return Team1[playerid] = 1;
return 1;
}
/*You can setplayer's team in this case like this:
Team1[playerid] = 1; //Then player is in team1.
Team2[playerid] = 1; //Then player is in team2.
*/