SA-MP Forums Archive
Anti-Team kill check - 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: Anti-Team kill check (/showthread.php?tid=166568)



Anti-Team kill check - Lorenc_ - 09.08.2010

Ok i was looking around the samp forum to find an anti-team kill. So this team kill should take no damage to a player on the attackers team and they said "Use SetPlayerTeam" so i used it but im not sure if my code will work. So can you guys check my code.

my code:

pawn Код:
if(gTeam[killerid] == gTeam[playerid]) {
    SetPlayerTeam(playerid, (What do i add here?)  );
    }


Thanks Lorenc, sorry for the awful grammar, in a rush :P


Re: Anti-Team kill check - Kar - 09.08.2010

u use a number. setplayerteam surposes anti team kill D:

SetPlayerTeam(playerid,1);


Re: Anti-Team kill check - ikey07 - 09.08.2010

OnPlayerConnect or Class regusest or even onplayerplawn

SetPlayerTeam(playerid,YourTeam);

it good if player get team when he is choosing skins, just small advice


Re: Anti-Team kill check - Kar - 09.08.2010

also u can just do it like gteams #define TEAMNAMEHERE 1 so u dont gotta be doing stupid one's


Re: Anti-Team kill check - denis1999 - 09.08.2010

#define ATTACK 1
#define DEFENCE 0

if(GetPlayerTeam(playerid) == ATTACK && GetPlayerTeam(killerid) == ATTACK){
SetPlayerTeam(killerid,DEFENCE);
}

if(GetPlayerTeam(playerid) == DEFENCE && GetPlayerTeam(killerid) == DEFENCE){
SetPlayerTeam(killerid,ATTACK);
}


Re: Anti-Team kill check - Hiddos - 09.08.2010

pawn Код:
SetPlayerTeam(killerid, GetPlayerTeam(playerid));
Might work. Why does everybody uses gTeam instead of GetPlayerTeam with SetPlayerTeam if the purpose is anti-teamkill?


Re: Anti-Team kill check - Lorenc_ - 09.08.2010

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
pawn Код:
SetPlayerTeam(killerid, GetPlayerTeam(playerid));
Might work. Why does everybody uses gTeam instead of GetPlayerTeam with SetPlayerTeam if the purpose is anti-teamkill?
I hope to hell it works