Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
- {
- new
- Float:hp,
- Float:ap;
- GetPlayerHealth(damagedid, hp);
- GetPlayerArmour(damagedid, ap);
- new
- Float: ap_hp = floatabs(ap - amount);
- if(hp - ap_hp < 0)
- SetPlayerHealth(damagedid, hp = 0.0);
- else
- SetPlayerHealth(damagedid, hp = hp - ap_hp);
- if(ap - amount < 0)
- SetPlayerArmour(damagedid, ap = 0.0);
- else
- SetPlayerArmour(damagedid, ap = ap - amount);
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
- {
- new
- Float:hp,
- Float:ap;
- GetPlayerHealth(playerid, hp);
- GetPlayerArmour(playerid, ap);
- new
- Float: ap_hp = floatabs(ap - amount);
- if(hp - ap_hp < 0)
- SetPlayerHealth(playerid, hp = 0.0);
- else
- SetPlayerHealth(playerid, hp = hp - ap_hp);
- if(ap - amount < 0)
- SetPlayerArmour(playerid, ap = 0.0);
- else
- SetPlayerArmour(playerid, ap = ap - amount);
- if(issuerid != INVALID_PLAYER_ID) {
- if(weaponid >= 0 && weaponid <= 46) {
- new
- str[128],
- weaponname[32];
- GetWeaponName(weaponid,weaponname,sizeof(weaponname));
- format(str, sizeof(str), "+%.0f %s", amount, weaponname);
- PlayerTextDrawSetString(issuerid, da_td[issuerid][0], str);
- format(str, sizeof(str), "%s[%d]", player[playerid][name], playerid);
- PlayerTextDrawSetString(issuerid, da_td[issuerid][1], str);
- format(str, sizeof(str), "Health: %.0f", hp);
- PlayerTextDrawSetString(issuerid, da_td[issuerid][2], str);
- format(str, sizeof(str), "Armour: %.0f", ap);
- PlayerTextDrawSetString(issuerid, da_td[issuerid][3], str);
- if(timershot[issuerid] != -1) {
- KillTimer(timershot[issuerid]);
- for(new i = 0; i < 4; i++)
- PlayerTextDrawHide(playerid, da_td[playerid][i]);
- }
- for(new i = 0; i < 4; i++)
- PlayerTextDrawShow(issuerid, da_td[issuerid][i]);
- timershot[issuerid] = SetTimerEx("TakeDamageTextDrawHide", 1000*5, false, "i", issuerid);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement