SA-MP Forums Archive
Custom damage problem - OnPlayerTakeDamage - 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: Custom damage problem - OnPlayerTakeDamage (/showthread.php?tid=552944)



Custom damage problem - OnPlayerTakeDamage - Chipardeur - 27.12.2014

Hi all,
I have a problem with my callback OnPlayerTakeDamage.
I've created a basic custom damage system but he doesn't work.
Can you help me ?
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        switch(weaponid)
        {
            case 31, 30, 24, 29:
            {
                new Float:armure, Float:vie, Float:degats;
                if(weaponid == 31) degats = 10.0;
                else if(weaponid == 30) degats = 17.5;
                else if(weaponid == 24) degats = 60.0;
                else if(weaponid == 29) degats = 10.0;
                GetPlayerHealth(playerid, vie);
                GetPlayerArmour(playerid, armure);
                if(armure > 0.0 && (armure-degats <= 0.0)) SetPlayerArmour(playerid, 0.0);
                else if(armure > 0.0 && (armure-degats) > 0.0) SetPlayerArmour(playerid, armure+amount-degats);
                else SetPlayerHealth(playerid, vie+amount-degats);
            }
            case 34:
            {
                if(bodypart == 9)
                {
                    new Float:Position[3], Float:Distance, string[145];
                    SetPlayerHealth(playerid, 0.0);
                    SetPlayerArmour(playerid, 0.0);
                    GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
                    Distance = GetPlayerDistanceFromPoint(issuerid, Position[0], Position[1], Position[2]);
                    format(string, sizeof(string), "(Administration) {FF5D47}%s a tuй %s d'un tir а la tкte а %.2fm de distance.", GetPseudoJoueur(issuerid), GetPseudoJoueur(playerid), Distance);
                    SendStaffMessage(COULEUR_ADMINISTRATION, string);
                }
                new Float:armure, Float:vie, Float:degats = 75.0;
                GetPlayerHealth(playerid, vie);
                GetPlayerArmour(playerid, armure);
                if(armure > 0.0 && (armure-degats <= 0.0)) SetPlayerArmour(playerid, 0.0);
                else if(armure > 0.0 && (armure-degats) > 0.0) SetPlayerArmour(playerid, armure+amount-degats);
                else SetPlayerHealth(playerid, vie+amount-degats);
            }
        }
    }
    return 1;
}



Respuesta: Custom damage problem - OnPlayerTakeDamage - Zume - 28.12.2014

try this > http://pastebin.com/uQ16hrQv

If you have a anticheat can that be the problem.


Re: Custom damage problem - OnPlayerTakeDamage - cessil - 28.12.2014

you haven't even said what about it doesn't work


Re : Custom damage problem - OnPlayerTakeDamage - Chipardeur - 28.12.2014

Yeah I have a selfmade anticheat but he doesn't detect HH so i don't know that can be the problem.
I really have no idea for my problem.


Re : Custom damage problem - OnPlayerTakeDamage - Chipardeur - 28.12.2014

He doesn't work because damages are not modified. They are the same than the original game.
EDIT: Sorry for DP, little mistake from myself.


Respuesta: Re : Custom damage problem - OnPlayerTakeDamage - Zume - 28.12.2014

the problem is that HP does not decrease? you have tried the code that I added?

If you have a anticheat you should apply the variables (in case) or function instead of SetPlayerHealth


Re : Custom damage problem - OnPlayerTakeDamage - Chipardeur - 28.12.2014

Yep, HP does not decrease.
I will try your code tomorrow, I keep you informed.