[Tutorial] Simple Realistic Damage Values
#21

I would do something along the lines of this.

pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    new Float:stat[2];
    GetPlayerHealth(playerid, stat[0]);
    GetPlayerArmour(playerid, stat[1]);
    new Damage;
    switch(weaponid)
    {
        case 31: Damage = 25; //set the damage here for when this switch is over
    }
    if(stat[1] > Damage) SetPlayerArmour(playerid, stat[1]-Damage);
    else if(stat[1] == Damage) SetPlayerArmour(playerid, 0);
    else if(stat[1] < Damage && stat[1] > 0)
    {
        new subval = floatround(stat[1])-Damage;
        //takes their armor, subtracts 25 from it. Then it adds that negative number to their health
        //For instance, 15 armor -25 = -10. So we subract 10 basically.
        SetPlayerArmour(playerid, 0);
        SetPlayerHealth(playerid, stat[0]+subval);
    }
    else SetPlayerHealth(playerid, stat[0]-Damage);
    return 1;
}
Reply


Messages In This Thread
Simple Realistic Damage Values - by zDevon - 31.03.2012, 03:11
Re: Simple Realistic Damage Values - by Reklez - 31.03.2012, 03:13
Re: Simple Realistic Damage Values - by MP2 - 31.03.2012, 03:14
Re: Simple Realistic Damage Values - by zDevon - 31.03.2012, 03:15
Re: Simple Realistic Damage Values - by MP2 - 31.03.2012, 03:16
Re: Simple Realistic Damage Values - by AceFlyer - 31.03.2012, 03:27
Re: Simple Realistic Damage Values - by zDevon - 31.03.2012, 03:33
Re: Simple Realistic Damage Values - by AceFlyer - 31.03.2012, 03:38
Re: Simple Realistic Damage Values - by zDevon - 31.03.2012, 03:44
Re: Simple Realistic Damage Values - by AceFlyer - 31.03.2012, 03:51
Re: Simple Realistic Damage Values - by zDevon - 31.03.2012, 03:53
Re: Simple Realistic Damage Values - by MP2 - 31.03.2012, 04:06
Re: Simple Realistic Damage Values - by AceFlyer - 31.03.2012, 04:19
Re: Simple Realistic Damage Values - by XFlawless - 31.03.2012, 04:20
Re: Simple Realistic Damage Values - by MP2 - 31.03.2012, 06:14
Re: Simple Realistic Damage Values - by System64 - 31.03.2012, 06:16
Re: Simple Realistic Damage Values - by Smacky - 31.03.2012, 07:56
Re: Simple Realistic Damage Values - by Wickeed - 31.03.2012, 08:03
Re: Simple Realistic Damage Values - by Nicholas. - 02.04.2012, 02:38
Re: Simple Realistic Damage Values - by 2KY - 02.04.2012, 02:48
Re: Simple Realistic Damage Values - by [ABK]Antonio - 02.04.2012, 03:04
Re: Simple Realistic Damage Values - by rati555 - 02.04.2012, 11:42
Re: Simple Realistic Damage Values - by [ABK]Antonio - 02.04.2012, 17:36
Re: Simple Realistic Damage Values - by DaRealShazz - 06.06.2012, 21:11
Re: Simple Realistic Damage Values - by Keelo - 18.07.2012, 15:08
Re: Simple Realistic Damage Values - by Coder_ - 19.07.2012, 10:16
Re: Simple Realistic Damage Values - by Coder_ - 31.07.2012, 19:36
Respuesta: Simple Realistic Damage Values - by Pottus - 05.08.2012, 20:45
Re: Simple Realistic Damage Values - by KingHual - 03.10.2012, 11:28
Re: Simple Realistic Damage Values - by Dziugsas - 09.05.2016, 05:31
Re: Simple Realistic Damage Values - by Manyula - 09.05.2016, 06:41
Re: Simple Realistic Damage Values - by pWesley - 10.05.2016, 19:05
Re: Simple Realistic Damage Values - by iSpy - 14.05.2016, 12:23
Re: Simple Realistic Damage Values - by TheMallard - 30.05.2016, 00:54
Re: Simple Realistic Damage Values - by Markhoss - 15.07.2016, 02:58
Re: Simple Realistic Damage Values - by Sibuscus - 16.03.2017, 15:19
Re: Simple Realistic Damage Values - by Dirda - 24.02.2018, 11:51

Forum Jump:


Users browsing this thread: 1 Guest(s)