Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
Ritzy2K - 29.04.2016
Well, How do i COMPLETELY Stop damaging a player when another player damages him / her? Returning 0 on playergivedamage or takedamage wont help?
Re: Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
Micko123 - 29.04.2016
Everything i can tell to you is to try it
Re: Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
Ritzy2K - 29.04.2016
Stop posting if you dont have anything which can help, I've already tried returning 0.
Re: Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
Unte99 - 29.04.2016
Try this:
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
new Float:currenthealth;
GetPlayerHealth(playerid, currenthealth);
SetPlayerHealth(playerid, currenthealth+amount);
return 1;
}
Re: Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
Ritzy2K - 29.04.2016
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?
Re: Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
CalvinC - 29.04.2016
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.
Re: Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
Ritzy2K - 29.04.2016
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?
Re: Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
CalvinC - 29.04.2016
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.
Re: Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
Ritzy2K - 29.04.2016
Thanks I'll try and come back to you.
Re: Will returning 0 OnPlayerTakeDamage, stop player from being damaged? -
Ritzy2K - 30.04.2016
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 :/