Minor help.(REPLY Please)
#1

Can someone please explain me, how to make an anti-team attack system.. I got the teams, i got everything simply i gave up at trying to make it so i had to post here, if anybody could help me that'd be awesome..
Reply
#2

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:
pawn Код:
OnPlayerSpawn(playerid)
{
  if(gTeam[playerid] == TEAM_ONE)
  {
   SetPlayerTeam(playerid, 1);
  }
  else if (gTeam[playerid] == TEAM_TWO)
  {
   SetPlayerTeam(playerid, 2);
  }
//ect..................
  return 1;
}
And there is an other simple way to do it using OnPlayerTakeDamage CallBack
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID && GetPlayerTeam(playerid) == GetPlayerTeam(issuerid))return 1;
    return 1;
}
And in case you use gTeam
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID && gTeam[playerid] == gTeam[issuerid])return 1;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)