Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock PlusMinusHealthArmour(playerid, Float:amount, Float:playerHealth, Float:playerArmour, Float:healthLimit = 100.0, Float:armourLimit = 100.0)
- {
- if(amount < 0)
- {
- amount *= -1;
- playerArmour -= amount;
- amount = 0.0;
- if(playerArmour < 0.0)
- {
- amount = floatsub(0.0, playerArmour);
- playerArmour = 0.0;
- }
- playerHealth -= amount;
- if(playerHealth < 0) playerHealth = 0;
- }
- else
- {
- playerHealth += amount;
- amount = 0.0;
- if(playerHealth > healthLimit)
- {
- amount = floatsub(playerHealth, healthLimit);
- playerHealth = healthLimit;
- }
- playerArmour += amount;
- if(playerArmour > armourLimit) playerArmour = armourLimit;
- }
- SetPlayerHealth(playerid, playerHealth);
- SetPlayerArmour(playerid, playerArmour);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement