Will returning 0 OnPlayerTakeDamage, stop player from being damaged?
#1

Well, How do i COMPLETELY Stop damaging a player when another player damages him / her? Returning 0 on playergivedamage or takedamage wont help?
Reply
#2

Everything i can tell to you is to try it
Reply
#3

Stop posting if you dont have anything which can help, I've already tried returning 0.
Reply
#4

Try this:

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
	new Float:currenthealth;
	GetPlayerHealth(playerid, currenthealth);
	SetPlayerHealth(playerid, currenthealth+amount);
	return 1;
}
Reply
#5

Quote:
Originally Posted by Unte99
Посмотреть сообщение
Try this:

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
	new Float:currenthealth;
	GetPlayerHealth(playerid, currenthealth);
	SetPlayerHealth(playerid, currenthealth+amount);
	return 1;
}
Suppose a player has very very Low Hp, like 2 a player shoots him with deagle, he'll die, Failing the whole system (in a way), Isn't there any single way to completely stop damging the player?
Reply
#6

No it doesn't, and Unte99's example wont work properly.
If you want to completely negate the damage you have to put them on the same team.
EDIT: You can return 0 in OnPlayerWeaponShot to stop the bullet from doing anything too.
Reply
#7

Well, i don't use the "team" thingy in my script, i use factions. I just want to stop damaging player if they are of same faction.
Wont returning 0 OnPlayerWeaponShot simply make the bullet useless? Can i Just make them Useless if they're shot to the member of the same faction, or the car occupied by him?
Reply
#8

Quote:
Originally Posted by [ND]xXZeusXx.
Посмотреть сообщение
Well, i don't use the "team" thingy in my script, i use factions. I just want to stop damaging player if they are of same faction.
Wont returning 0 OnPlayerWeaponShot simply make the bullet useless? Can i Just make them Useless if they're shot to the member of the same faction, or the car occupied by him?
Yea if you return 0 the bullet wont do anything, so just check if hitid is same faction and return 0, and make sure it's not an object.
Reply
#9

Thanks I'll try and come back to you.
Reply
#10

So, i added this under OnPlayerWeaponShot

Код:
if(!IsValidObject(hitid))
	{
	     if(GetFactionType(playerid) == GetFactionType(hitid) && PlayerData[playerid][pOnDuty] && PlayerData[hitid][pOnDuty])
    		return 0;
	}
I want that if player are of same faction and both are on duty, They cannot damage each other. But it works in a strange way, one can damage and one cannot. I dont know why :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)