Damage bug
#1

When players hit each other with Sawn Off or Sniper sometimes it doesn't take damage of the player who is hited. But this doesn't happen always.
Any ideas why is this happening?
I don't have OnPlayerTakeDamage and OnPlayerGiveDamage, under my OnPlayerWeaponShot I have this:
Код:
public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ )
{
        if(IsPlayerInRangeOfPoint(playerid, 30.0, 1684.5532,1446.9314,10.7706))
		{
		SendClientMessage(playerid,COLOR_RED,"Докато си близо до SPAWN-а, не можеш да стреляш!");
		return 0;
		}
		if(IsPlayerInRangeOfPoint(hitid, 30.0, 1684.5532,1446.9314,10.7706))
		{
		SetPlayerHealth(hitid,100); SetPlayerArmour(hitid,100);
		SendClientMessage(playerid,COLOR_RED,"Не можеш да стреляш по играч, който е близо до SPAWN-а!");
		SendClientMessage(hitid,COLOR_RED,"Докато си близо до SPAWN-а, не можеш да бъдеш убит!");
		return 0;
		}
    return 1;
}
Thanks in advance!
Reply
#2

Someone help please
Reply
#3

But this is happening outside the area in this IF statement?
Reply
#4

OnPlayerWeaponShot, won't help you in the damage thing, The OnPlayerTakeDamage and OnPlayerGiveDamage, make sure that you return 1/return damage under them, But the weapon shot doesn't get into the damage
Reply
#5

I had this before:
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
	{
		return 1;
	}

	public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
	{
		return 1;
	}
but the problem was still there.
Reply
#6

try return amount
Reply
#7

It gives me this warning:
Код:
warning 213: tag mismatch
in the return lines

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
	{
		return amount;
	}

	public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
	{
		return amount;
	}
Reply
#8

your function is not completed

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
Reply
#9

That helped for some weapons! Thanks! Some of the weapons like sniper are now OK but there is problem only with the Sawnoff Shotgun. Any ideas why this is happening? I have no specifications for individual weapons in my code.
This is happening only if the hited player is moving. If he/she stand without moving, it takes damage normally.
Reply
#10

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
try return amount
Try dancing in a circle while holding a burning voodoo puppet.

Seriously, what? That function doesn't even handle float return values (otherwise it would have a Float tag), so what would returning the amount do?
Furthermore, the return value of OnPlayerGive/TakeDamage does not influence any damage taken/given/processed or whatever. The only thing it does is tell the server if the callback should be called in other scripts in the chain. Returning 0 in a filterscript will prevent the callback from being called in the next filterscripts and gamemode, etc.

Only OnPlayerWeaponShoot can prevent damage by returning 0.

If you don't know what it does, look it up and don't throw around ideas that might actually break stuff (returning 0 can break the callback for other scripts if this is not intended).
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)