Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
- {
- new Float:Life, Float:Coleete, Float:Dano;
- GetPlayerArmour(damagedid, Coleete);
- GetPlayerHealth(damagedid, Life);
- if(Coleete > 0)
- {
- if(amount > Coleete)
- {
- Dano = amount - Coleete;
- Life = Life - Dano;
- SetPlayerArmour(damagedid, 0.0);
- SetPlayerHealth(damagedid, Life);
- return 1;
- }
- Coleete = Coleete - amount;
- SetPlayerArmour(damagedid, Coleete);
- }
- if(Coleete < 1)
- {
- Life = Life - amount;
- SetPlayerHealth(damagedid, Life);
- }
- return 1;
- }
- // Código feito por: Smith.
- // Código mais otimizado:
- public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid) {
- new Float: Life[2];
- GetPlayerHealth(damagedid, Life[0]);
- GetPlayerArmour(damagedid, Life[1]);
- if(Life[1]) {
- if(amount > Life[1]) {
- Life[0] = Life[0] - (amount - Life[1]);
- SetPlayerArmour(damagedid, 0.0);
- SetPlayerHealth(damagedid, Life[0]);
- return 1;
- }
- Life[1] = Life[1] - amount;
- SetPlayerArmour(damagedid, Life[1]);
- } else {
- Life[0] = Life[0] - amount;
- SetPlayerHealth(damagedid, Life[0]);
- }
- return 1;
- }
- // Código feito por: Paulor.
Advertisement
Add Comment
Please, Sign In to add comment