22.12.2012, 19:14
Well there are a lot of ways, here are the easiest
In case you didn't use the fonctions SetPlayerTeam and GetPlayerTeam,and used gTeam instead use them, its the best way to prevent Team Kill
Example:
And there is an other simple way to do it using OnPlayerTakeDamage CallBack
And in case you use gTeam
In case you didn't use the fonctions SetPlayerTeam and GetPlayerTeam,and used gTeam instead use them, its the best way to prevent Team Kill
Example:
pawn Код:
OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == TEAM_ONE)
{
SetPlayerTeam(playerid, 1);
}
else if (gTeam[playerid] == TEAM_TWO)
{
SetPlayerTeam(playerid, 2);
}
//ect..................
return 1;
}
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID && GetPlayerTeam(playerid) == GetPlayerTeam(issuerid))return 1;
return 1;
}
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID && gTeam[playerid] == gTeam[issuerid])return 1;
return 1;
}