Need help with damage count
#1

Hi there. I need help with damage count.
We are creating an attack versus defend mode. After base finishes, we have a dialogue which shows who did how many kill and damage. Problem is, if you killed a guy which had 15hp(for example) with deagle it says you took 46 hp from the guy you killed. But it shouldn't be more damage than the guy has. If you hit a guy who has 40 damage with deagle, it should count it as 40 damage, not 46.
Hope you got it. Thanks
Reply
#2

Here you go:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    new Float:hp;
    GetPlayerHealth(playerid,hp);
    new Float:damage = (amount > hp) ? hp : amount;  // this is the value you need
// ...
    return 1;
}
Hope I get you right.
Reply
#3

Quote:
Originally Posted by Norck
Посмотреть сообщение
Here you go:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    new Float:hp;
    GetPlayerHealth(playerid,hp);
    new Float:damage = (amount > hp) ? hp : amount;  // this is the value you need
// ...
    return 1;
}
Hope I get you right.
Thanks for giving time. I'll try it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)