Prevent OnPlayerDeath to step in
#1

Hello everyone,
As always, every topic of mine is basing on revamping something in my gamemode. This time I thought about revamping the death system so... let's get down to explaining. First of all, I would like that the player would not need to have 0HP to be considered dead, and that can be possible by using OnPlayerTakeDamage, but however I use it, it's not working as it needs to, if I set the player to be brutally wounded at 20HP or less, and dead around 15HP or less. Well this system which I thought about doesn't work how it should work and it still does the OnPlayerDeath thing.

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{

        if((0 <= weaponid <= 46) || weaponid == 54)
        {
                if(BODY_PART_TORSO <= bodypart <= BODY_PART_HEAD) Damage[playerid][(bodypart - 3)][weaponid]++;
        }

        new Float:health;
        GetPlayerHealth(playerid,health);

        if(health < 35.0 && PlayerInfo[playerid][pLowSkillNotified] == 0)
        {
                SCM(playerid, COLOR_LIGHTRED, "> Low health, shooting skills at medium.");
                PlayerInfo[playerid][pLowSkillNotified] = 1;
        }
        if(health < 25.0 && PlayerInfo[playerid][pLowSkillNotified] == 1)
        {
                SCM(playerid, COLOR_LIGHTRED, "> Very low health, shooting skills at low.");
                PlayerInfo[playerid][pLowSkillNotified] = 2;
        }
        if(health <= 20.0 && PlayerInfo[playerid][pBrutally] == 0 && DeadNotify[playerid] == 0)
        {
                SCM(playerid, COLOR_LIGHTRED, "You are brutally wounded, you may wait for a medic or write /acceptdeath.");
                new stringdamage[128];
                new stringdamage2[128];
                format(stringdamage, sizeof(stringdamage), "(( This player is brutally wounded. He has been hit %d times\n/damages %d ))", CountDamages(playerid), playerid);
                strcat(stringdamage, stringdamage2);

                DamageShot[playerid] = Create3DTextLabel(stringdamage, 0xFF8080FF, 30.0, 40.0, 0.0, 20.0, 0, 0);
                Attach3DTextLabelToPlayer(DamageShot[playerid], playerid, 0.0, 0.0, 0.0);

                FreezePlayer(playerid);
                OnAnim{playerid} = true;
                ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE",3.5,0,0,0,1,0);

                SetIntVar(playerid, "JustDied", 1);
                PlayerInfo[playerid][pBrutally] = 1;
                DeadNotify[playerid] = 1;
        }
        if(health <= 15.0 && PlayerInfo[playerid][pBrutally] == 1 && DeadNotify[playerid] == 1)
        {
                SCM(playerid, COLOR_LIGHTRED, "You are dead now. You can use /respawnme in 60 seconds.");
                new stringdamage[128];
                new stringdamage2[128];
                format(stringdamage, sizeof(stringdamage), "(( THIS PLAYER IS DEAD ))");
                strcat(stringdamage, stringdamage2);

                DamageShot[playerid] = Create3DTextLabel(stringdamage, 0xFF8080FF, 30.0, 40.0, 0.0, 20.0, 0, 0);
                Attach3DTextLabelToPlayer(DamageShot[playerid], playerid, 0.0, 0.0, 0.0);

                FreezePlayer(playerid);
                OnAnim{playerid} = true;
                ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE",3.5,0,0,0,1,0);

                SetIntVar(playerid, "JustDied", 2);
                PlayerInfo[playerid][pBrutally] = 2;
                DeadNotify[playerid] = 2;
        }
        return 1;
}
Reply


Messages In This Thread
Prevent OnPlayerDeath to step in - by AidanRO - 15.05.2016, 09:06
Re: Prevent OnPlayerDeath to step in - by MBilal - 15.05.2016, 10:06

Forum Jump:


Users browsing this thread: 1 Guest(s)