Anti-Team kill
#1

Код:
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.
Reply
#2

What you want the code does?
Reply
#3

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
Reply
#4

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
Reply
#5

Код:
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.
Reply
#6

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.
Reply
#7

use this:
PHP код:
public OnPlayerTakeDamage(playerid,issuerid,Float:amount,weaponid){
    if(
playerTeam[playerid]==playerTeam[issuerid])return 0;
    return 
1;} 
Reply
#8

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 :/
Reply
#9

PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponid)
{
    if(
GetPlayerTeam(playerid) == GetPlayerTeam(issuerid)) return 0;
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)