Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart) {
- if(damagedid != INVALID_PLAYER_ID) {
- new Float: HP, Float: AP ;
- GetPlayerHealthEx(damagedid,HP);
- GetPlayerArmourEx(damagedid,AP);
- if(AP >= amount) SetPlayerArmourEx (damagedid, AP - amount);
- else if(AP <= 0) {
- new const Float: remainHP = HP - amount;
- SetPlayerHealthEx(damagedid, remainHP);
- if( remainHP <= 0 ) {
- OnPlayerDeath(damagedid, playerid, weaponid);
- playerDeath[damagedid] = 1;
- return 1;
- }
- }
- else {
- new const Float: remainHP = HP + (AP - amount);
- SetPlayerArmourEx(damagedid, 0.0);
- SetPlayerHealthEx(damagedid, remainHP);
- if( remainHP <= 0 )
- {
- OnPlayerDeath(damagedid, playerid, weaponid);
- playerDeath[damagedid] = 1;
- return 1;
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement