SA-MP Forums Archive
Potence and Endurance - 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: Potence and Endurance (/showthread.php?tid=645891)



Potence and Endurance - NealPeteros - 06.12.2017

So, I'm trying to create a potency and endurance system. The rate of a player's potency affects his unarmed damage(fist) while the rate of a player's endurance affects how much damage is reduced from getting hit from unarmed damage(fist). I was getting through complex(at least it is for me) lines of code, and I kinda got lost while doing it. Am I doing it right or...?

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
PlayerInfo[issuerid][Potency] >= 10 && weaponid == 0)
    {
        new 
Float:damageFloat:currenth;
        
damage PlayerInfo[issuerid][Potency]+5;
        if(
PlayerInfo[playerid][Endurance] >= 10 && weaponid == 0)
        {
            new 
Float:healthFloat:curhealth;
            
health PlayerInfo[playerid][Endurance]+5-damage;
            
GetPlayerHealth(playeridcurhealth);
            
SetPlayerHealth(playeridcurhealth+health);
        }
        else
        {
            
GetPlayerHealth(playeridcurrenth);
            
SetPlayerHealth(playerid, (currenth+amount)-damage);        
        }
    }
    else
    {
        if(
PlayerInfo[playerid][Endurance] >= 10 && weaponid == 0)
        {
            new 
Float:healthFloat:curhealth;
            
health PlayerInfo[playerid][Endurance]-5;
            
GetPlayerHealth(playeridcurhealth);
            
SetPlayerHealth(playeridcurhealth+health);
        }
    }
    return 
1;