Anti-Team kill - 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)
+--- Thread: Anti-Team kill (
/showthread.php?tid=602286)
Anti-Team kill -
iulicxd - 05.03.2016
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(playerTeam[playerid] == playerTeam[issuerid])
{
new Float:h; GetPlayerHealth(playerid,h);
SetPlayerHealth(playerid,h+amount);
}
return 1;
}
But it not working good,if i shoot with m4 or ak47,health is going down!
Sorry for my english.
Re: Anti-Team kill -
xEF - 05.03.2016
What you want the code does?
Re: Anti-Team kill -
iulicxd - 05.03.2016
Quote:
Originally Posted by xEF
What you want the code does?
|
If a player shoot in a player of his team,player of his team do not losing health
Re: Anti-Team kill -
itsCody - 05.03.2016
You could set their teams,
https://sampwiki.blast.hk/wiki/SetPlayerTeam
And, if you don't want them to damage vehicles their team is driving, this is useful too.
https://sampwiki.blast.hk/wiki/EnableVehicleFriendlyFire
Re: Anti-Team kill -
xEF - 05.03.2016
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new Float:h
GetPlayerHealth(issuerid,h);
new skin1, skin2;
skin1 = GetPlayerSkin(playerid);
skin2 = GetPlayerSkin(issuerid)
if(skin1 == skin2)
{
SetPlayerHealth(issuerid,h);
}
return 1;
}
Not tested yet.
Regards,
Rodri.
Re: Anti-Team kill -
Threshold - 05.03.2016
Teams are not always defined by skins... Not everything revolves around the server you play on. SetPlayerTeam handles this for you by default, so use that.
Re: Anti-Team kill -
GeneralAref - 05.03.2016
use this:
PHP код:
public OnPlayerTakeDamage(playerid,issuerid,Float:amount,weaponid){
if(playerTeam[playerid]==playerTeam[issuerid])return 0;
return 1;}
Re: Anti-Team kill -
YoussefHammad - 05.03.2016
I suggest u make a specific color with SetPlayerColor for every team. For example, we have team A and team B
when a player joins Team A set his color to red so that all team A members color is red , and if a player is joining team B set his color to blue so that all players in team B has color blue , so when a player eith color red shoots another play with the same color he remaims un affected
Sorry couldnt type the code because im on from the phone :/
Re: Anti-Team kill -
MicroKyrr - 06.03.2016
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(GetPlayerTeam(playerid) == GetPlayerTeam(issuerid)) return 0;
return 1;
}