Help set 0 damage onplayertakedamage
#1

I try to put to 0 my damages onplayertakedamage, it's work if u use eagle, shotgun, but if u use MP5,M4,
some damage happen

Код:
		else if(IsACop(issuerid) && IsACop(playerid))
		{
			new string[50];
			new Float:slx, Float:sly, Float:slz;
			GetPlayerPos(issuerid, slx, sly, slz);
			SetPlayerPos(issuerid, slx, sly, slz+3);
			PlayerPlaySound(issuerid, 1130, slx, sly, slz+3);
			format(string, sizeof(string), "~r~DONT ATTACK ~b~TEAM MATES!");
			GameTextForPlayer(issuerid, string, 2000, 3);
			dmg[issuerid] = 0.0;
		}
Код:
		new Float:a;
		GetPlayerArmour(playerid, a);
		new Float:h;
		GetPlayerHealth(playerid, h);
		if(dmg[issuerid] > 0) {
			if(a > 0.0) { // se tiver colete
				if(dmg[issuerid] > a) {
					resto[playerid] = dmg[issuerid] - a;
					SetPlayerArmourEx(playerid, 0);

					novavida[playerid] = h - resto[playerid];
					SetPlayerHealthEx(playerid, novavida[playerid]);
				}
				else if(dmg[issuerid] <= a) {
					novavida[playerid] = a - dmg[issuerid];
					SetPlayerArmourEx(playerid, novavida[playerid]);
				}
			}
			else { // se nгo tiver colete
				novavida[playerid] = h - dmg[issuerid];
				SetPlayerHealthEx(playerid, novavida[playerid]);
			}
		} else {
			SetPlayerHealthEx(playerid, h);
			SetPlayerArmourEx(playerid, a);
		}
Reply
#2

If you want to negate damage done to certain players you could do it like this:

Код:
new Float:h;
GetPlayerHealth(playerid, h);
SetPlayerHealth(playerid, h + dmg);
This way, no matter what weapon you use, the damage that the weapon does will be given back to the player as health, resulting in 0 damage done overall.
Reply
#3

You can't do it :/
Server lag / Players lag
If you need to prevent players from damage each others
Use SetPlayerTeam, GetPlayerTeam
Reply
#4

Quote:
Originally Posted by karemmahmed22
Посмотреть сообщение
You can't do it :/
Server lag / Players lag
If you need to prevent players from damage each others
Use SetPlayerTeam, GetPlayerTeam
ty +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)