SA-MP Forums Archive
"Players in the same team cant kill each other", aha -.- - 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: "Players in the same team cant kill each other", aha -.- (/showthread.php?tid=138085)



"Players in the same team cant kill each other", aha -.- - Ass.Embler - 31.03.2010

Hey guys!
(I am a newby)

I have got a nasty problem: tk'ers.
Players in the same team can kill each other on my server.

Here my idea:

I set the team of the player when he select the Class X.

Код:
public OnPlayerRequestClass(playerid,classid)
{
   switch(classid)
  {
   // .....
     case 0: // Army
     {
       //...
       teamid[playerid]=0;
     }
  }
}
And set the team directly when he spawns

Код:
public OnPlayerSpawn(playerid)
{
   switch(teamid[playerid])
  {
   // .....
     case 0: // Army
     {
       //...
       SetPlayerTeam(playerid, 0);
     }
  }
}
But sometimes, they can kill each other..

why ??

PS: I solved the problem with a kick(playerid); in OnPlayerDeath(playerid,killerid,reason): if(teamid[..]==teamid[..]) kick(..);
But .. thats not very nice =/