Help with Health and Armour (Limits)
#4

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == lvapickup1)
    {
        new Float:armour;
        GetPlayerArmour(playerid, armour);
        if(armour < 100.0)
        {
            new Float:var = armour + 50.0;
            SetPlayerArmour(playerid, (var > 100.0) ? (100.0) : (var));
            GameTextForPlayer(playerid, "~g~Armour +50", 3000, 3);
        }
        else
        {
            //?
        }
    }
    else if(pickupid == lvapickup2)
    {
        new Float:hp;
        GetPlayerHealth(playerid, hp);
        if(hp < 100.0)
        {
            new Float:var = hp + 50.0;
            SetPlayerHealth(playerid, (var > 100.0) ? (100.0) : (var));
            GameTextForPlayer(playerid, "~g~Health +50", 3000, 3);
        }
        else
        {
            //?
        }
    }
    return 1;
}
This line:
pawn Код:
SetPlayerArmour(playerid, (var > 100.0) ? (100.0) : (var));
Is basically the same as:
pawn Код:
if((armour + 50.0) > 100.0) SetPlayerArmour(playerid, 100.0);
else SetPlayerArmour(playerid, armour + 50.0);
Reply


Messages In This Thread
Help with Health and Armour (Limits) - by kbalor - 16.10.2014, 06:49
Re: Help with Health and Armour (Limits) - by RockyGamer - 16.10.2014, 07:52
Re: Help with Health and Armour (Limits) - by kbalor - 16.10.2014, 08:08
Re: Help with Health and Armour (Limits) - by Threshold - 16.10.2014, 08:15
Re: Help with Health and Armour (Limits) - by RockyGamer - 16.10.2014, 08:18
Re: Help with Health and Armour (Limits) - by kbalor - 16.10.2014, 08:22

Forum Jump:


Users browsing this thread: 1 Guest(s)