Team Kill
#1

Code to disable Team Killing?
Reply
#2

amm ? you should tell us a bit more lol
Reply
#3

SetPlayerTeam
Reply
#4

Yes I have Teams and all, but I would like to disable Team Killing, so TEAM_POLICE cant kill TEAM_POLICE!
Reply
#5

Umm, you can create a punishment for players that team kill.

like

Код:
if(Team[playerid] == Team[killerid])
{
//Do something here
}
return 1;
}
Reply
#6

pawn Код:
if(gTeam[playerid] == gTeam[killerid])
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(killerid,X,Y,Z);
CreateExplosion(X,Y,Z,7,20);
SetPlayerHealth(killerid,0);
GameTextForPlayer(killerid,"~r~ Do not Team Kill",3000,1);
}
Add this under OnPlayerDeath
Reply
#7

Nah, I know that, but I need code that player cant team kill. Any more help?
Reply
#8

pawn Код:
if(gTeam[playerid] == gTeam[killerid])
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(killerid,X,Y,Z);
CreateExplosion(X,Y,Z,7,20);
SetPlayerHealth(killerid,0);
GameTextForPlayer(killerid,"~r~ Do not Team Kill",3000,1);
}
Add this under OnPlayerDeath

And if you want that when you shoot the player , health does not go down then you dont have to do anything because as you mentioned above that you already have teams defined , so they cant kill each other already
Reply
#9

You have to set your teams with SetPlayerTeam. That's all.

https://sampwiki.blast.hk/wiki/SetPlayerTeam
Reply
#10

ah, ok than, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)