Undamage-able
#1

Hello, I have created two classes, Civilians and Cops.
pTeam[playerid] is for the teams, And the cops team is "teCop".

Can someone help me in making them cannot damage each other? I mean If Cop1 shoots Cop2, Cop2 won't be damaged, How ?
Reply
#2

Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
{
	if(GetPlayerTeam(playerid) == GetPlayerTeam(damagedid)) // Little check to see if both players are on the same team
	{  
		new Float:hp; 
		GetPlayerHealth(playerid, hp); 
		SetPlayerHealth(playerid, hp-10.0);
		SendClientMessage(playerid, 0xFF6347AA, "You've shot your own teammate and therefore you have lost health!");
        }
}
Reply
#3

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
{
	if(GetPlayerTeam(playerid) == GetPlayerTeam(damagedid)) // Little check to see if both players are on the same team
	{  
		new Float:hp; 
		GetPlayerHealth(playerid, hp); 
		SetPlayerHealth(playerid, hp-10.0);
		SendClientMessage(playerid, 0xFF6347AA, "You've shot your own teammate and therefore you have lost health!");
        }
}
Should I add return 0; under SendClientMessage function ?
Reply
#4

Quote:
Originally Posted by aCloudy
Посмотреть сообщение
Should I add return 0; under SendClientMessage function ?
I think so, try it and if it doesn't work post here again.
Reply
#5

This is what you're looking for:

https://sampwiki.blast.hk/wiki/SetPlayerTeam

Set all cops on the same team so they can't damage each other.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)