Potence and Endurance
#1

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;

Reply


Messages In This Thread
Potence and Endurance - by NealPeteros - 06.12.2017, 11:54

Forum Jump:


Users browsing this thread: 1 Guest(s)