SA-MP Forums Archive
Problem with health bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with health bug (/showthread.php?tid=472008)



Problem with health bug - Lops - 26.10.2013

I have problem with health losing.
So, if someone shoot me or i jump down from the building roof, it takes away amount of health, but then health recovers immidiently. There's no way to die.
Problem is in the roleplay server and i can't figure it out by myself.
Maybe someone know the issue/problem?


Re: Problem with health bug - Lops - 28.10.2013

Someone know the solution?


Re: Problem with health bug - ]Rafaellos[ - 28.10.2013

Is there any timer that restore health back to 100? Or on OnPlayerUpdate or on OnPlayerTakeDamage? Check you'r Gamemode and you'r Filterscripts.


Re: Problem with health bug - Lops - 28.10.2013

Maybe my OnPlayerTakeDamage and GiveDamage helps. Can't find the timers, what sets the health to 100.

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
        new Float:armourloss, Float:healthloss, Float:pArmour;
        GetPlayerArmour(playerid, pArmour);
        if(pArmour != 0)
        {
                if(amount > pArmour)
                {
                        armourloss = pArmour;
                        healthloss = amount-pArmour;
                }
                else
                {
                        armourloss = amount;
                }
        }
        else healthloss = amount;

     
        CallLocalFunction("OnPlayerTakeDamageEx", "iiffi", playerid, issuerid, healthloss, armourloss, weaponid);

    #if defined OPGTD_OnPlayerTakeDamage
        return OPGTD_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
    #else
        return 1;
    #endif
}
#if defined OPGTD_OnPlayerTakeDamage
    forward OPGTD_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
#endif
#if defined _ALS_OnPlayerTakeDamage
    #undef OnPlayerTakeDamage
#else
    #define _ALS_OnPlayerTakeDamage
#endif
#define OnPlayerTakeDamage OPGTD_OnPlayerTakeDamage

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
        new Float:armourloss, Float:healthloss, Float:pArmour;
        GetPlayerArmour(damagedid, pArmour);
        if(pArmour != 0)
        {
                if(amount > pArmour)
                {
                        armourloss = pArmour;
                        healthloss = amount-pArmour;
                }
                else
                {
                        armourloss = amount;
                }
        }
        else healthloss = amount;

        CallLocalFunction("OnPlayerGiveDamageEx", "iiffi", playerid, damagedid, healthloss, armourloss, weaponid);

    #if defined OPGTD_OnPlayerGiveDamage
        return OPGTD_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid);
    #else
        return 1;
    #endif
}
#if defined OPGTD_OnPlayerGiveDamage
    forward OPGTD_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid);
#endif
#if defined _ALS_OnPlayerGiveDamage
    #undef OnPlayerGiveDamage
#else
    #define _ALS_OnPlayerGiveDamage
#endif
#define OnPlayerGiveDamage OPGTD_OnPlayerGiveDamage



Re: Problem with health bug - -=Dar[K]Lord=- - 28.10.2013

i think you should post the codes of OnPlayerTakeDamageEx And OnPlayerGiveDamageEx too... so that it might have the codes which gives the player health again.. cuz its calling a LocalFunctionAgain in there which isnt a timer but a function can have anything such as giving player a weapon setting textdraws , logging player , registring player , Anything...
Untill you post that code we cannot help you..