SA-MP Forums Archive
How to make it... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make it... (/showthread.php?tid=86599)



How to make it... - krawN - 15.07.2009

Hey.

I've created 4 teams on my server. There's 2 teams of cops, who are alliated, and 2 more teams called militars, who also are alliated.

#define TEAM_COP 0
#define TEAM_COP2 0

#define TEAM_MILITAR 1
#define TEAM_MILITAR2 1

They are defined by gTeam. My question is... how could I create an anti team killer? But only with him team, for example, TEAM_COP can't kill TEAM_COP2, but can kill TEAM_MILITAR and TEAM_MILITAR2.

Thanks


Re: How to make it... - tjying95 - 15.07.2009

You can use
Код:
SetPlayerTeam(playerid, team)
Example, like team cop and cop2
Код:
SetPlayerTeam(playerid, 1)
and the other team
Код:
SetPlayerTeam(playerid, 2)



Re: How to make it... - coffeecup92 - 15.07.2009

Quote:
Originally Posted by tjying95
You can use
Код:
SetPlayerTeam(playerid, team)
Example, like team cop and cop2
Код:
SetPlayerTeam(playerid, 1)
and the other team
Код:
SetPlayerTeam(playerid, 2)
You're totally wrong. He wants to know how to make an anti team kill thing.


Re: How to make it... - DeathOnaStick - 15.07.2009

He's not wrong... you can paste that under OnPlayerDeath...
smth like:

Код:
if(GetPlayerTeam(playerid)==1)
{
if(GetPlayerTeam(killerid)==1)
{
//the thing that should happen in case of TK
}
}



Re: How to make it... - coffeecup92 - 15.07.2009

1. Your code fails.
2. He want to know how to make it like when a player attacks a player from his own team, the player that he attacked wouldn't lose any health.

EDIT: Your code still fails.


Re: How to make it... - DeathOnaStick - 15.07.2009

I see :/


Re: How to make it... - Abernethy - 15.07.2009

pawn Код:
// OnPlayerSpawn
  if(gTeam[playerid] == 0)
  {
    SetPlayerTeam(playerid, 0);
  }
  else if (gTeam[playerid] == 1)
  {
    SetPlayerTeam(playerid, 1);
  }



Re: How to make it... - krawN - 15.07.2009

Quote:
Originally Posted by Abernethy
pawn Код:
// OnPlayerSpawn
  if(gTeam[playerid] == 0)
  {
    SetPlayerTeam(playerid, 0);
  }
  else if (gTeam[playerid] == 1)
  {
    SetPlayerTeam(playerid, 1);
  }
I'm confused... what's that?