anti teamkill question - 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 teamkill question (
/showthread.php?tid=549431)
anti teamkill question -
1fret - 06.12.2014
Im trying to make my own anti team kill but what i want is. if the shooter and the target is on same team i want the shooter life to decrease each time they shoot a team mate.
Re: anti teamkill question -
M4D - 06.12.2014
i explained it for you in code with comments...
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) //>call when someone takes damage.
{
if(issuerid != INVALID_PLAYER_ID && playerid != INVALID_PLAYER_ID)
{
if(GetPlayerTeam(playerid) == GetPlayerTeam(issuerid)) //> If issuerid (who gives damage) and playerid (who taked damage) was same
{
new Float:AttackerHP; //>Variable for get issuer id health amount
GetPlayerHealth(issuerid, AttackerHP); //>Get it
SetPlayerHealth(issuerid, AttackerHP-10.0); //>decrease 10% of his health ...
}
}
return 1;
}
try to undrestand code
if you have problem with this reply here
good luck
Re: anti teamkill question -
1fret - 06.12.2014
thanks man