Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public SetPlayerHealthEx(playerid, Float:hp);
- {
- Health[playerid] = hp;
- return SetPlayerHealth(playerid, hp);
- }
- public SetPlayerArmourEx(playerid, Float:ar);
- {
- Armour[playerid] = ar;
- return SetPlayerArmour(playerid, ar);
- }
- //to onplayergivedamage
- if(damagedid != INVALID_PLAYER_ID)
- {
- if(!IsPlayerDead[damagedid)
- {
- new Float: HP, Float: AP;
- GetPlayerHealthEx(damagedid,HP);
- GetPlayerArmourEx(damagedid,AP);
- if ( AP >= amount )
- {
- SetPlayerArmourEx ( damagedid, AP - amount );
- }
- else if ( AP <= 0 )
- {
- new Float: remainHP = HP - amount;
- SetPlayerHealthEx ( damagedid, remainHP );
- if ( remainHP <= 1 )
- {
- OnPlayerDeath( damagedid, playerid, weaponid );
- SetPlayerHealthEx ( damagedid, 0.0 );
- IsPlayerDead[damagedid] = true;
- }
- }
- else
- {
- new Float: remainHP = HP + ( AP - amount );
- SetPlayerArmourEx ( damagedid, 0.0 );
- SetPlayerHealthEx ( damagedid, remainHP );
- if ( remainHP <= 1 )
- {
- OnPlayerDeath( damagedid, playerid, weaponid );
- SetPlayerHealthEx ( damagedid, 0.0 );
- IsPlayerDead[damagedid] = true;
- }
- }
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment