Advertisement
Guest User

OPD v3.0

a guest
Oct 11th, 2011
728
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.28 KB | None | 0 0
  1. /********************************************
  2.  * OnPlayerDamage(Ex)! V3.0             *
  3.  * OnPlayerTakeDamage(playerid, issuerid, Float:HealthLost,Float:ArmourLost, weaponid);
  4.  * OnPlayerGiveDamage(playerid, damagedid, Float:HealthLost,Float:ArmourLost, weaponid);
  5.  * Credits: wups                            *
  6.  ********************************************/
  7.  
  8. #include <a_samp>
  9.  
  10. static
  11.     Float:Ex_PHealth[MAX_PLAYERS],
  12.     Float:Ex_Armour[MAX_PLAYERS],
  13.     bool:Ex_OPU;
  14.    
  15. public OnPlayerUpdate(playerid)
  16. {
  17.     GetPlayerHealth(playerid,Ex_PHealth[playerid]);
  18.     GetPlayerArmour(playerid,Ex_Armour[playerid]);
  19.     return (Ex_OPU)?CallLocalFunction("Ex_OnPlayerUpdate","i",playerid):1;
  20. }
  21. #if defined _ALS_OnPlayerUpdate
  22.     #undef OnOnPlayerUpdate
  23. #else
  24.     #define _ALS_OnPlayerUpdate
  25. #endif
  26. #define OnPlayerUpdate Ex_OnPlayerUpdate
  27. forward Ex_OnPlayerUpdate(playerid);
  28. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
  29. {
  30.     new
  31.         Float:Ex_HP,
  32.         Float:Ex_AP,
  33.         Float:Ret_HPLost,
  34.         Float:Ret_APLost;
  35.     GetPlayerHealth(playerid,Ex_HP);
  36.     GetPlayerArmour(playerid,Ex_AP);
  37.     if(Ex_AP != Ex_Armour[playerid]) Ret_APLost = (Ex_Armour[playerid]-Ex_AP);
  38.     if(Ex_HP != Ex_PHealth[playerid]) Ret_HPLost = (Ex_PHealth[playerid]-Ex_HP);
  39.     Ex_PHealth[playerid]=Ex_HP;
  40.     Ex_Armour[playerid]=Ex_AP;
  41.     return CallLocalFunction("Ex_OnPlayerTakeDamage","iiffi", playerid,issuerid,Ret_HPLost,Ret_APLost,weaponid);
  42. }
  43. #if defined _ALS_OnPlayerTakeDamage
  44.     #undef OnPlayerTakeDamage
  45. #else
  46.     #define _ALS_OnPlayerTakeDamage
  47. #endif
  48. #define OnPlayerTakeDamage Ex_OnPlayerTakeDamage
  49. forward Ex_OnPlayerTakeDamage(playerid, issuerid, Float:HealthLost,Float:ArmourLost, weaponid);
  50. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
  51. {
  52.     new
  53.         Float:Ex_HP,
  54.         Float:Ex_AP,
  55.         Float:Ret_HPLost,
  56.         Float:Ret_APLost;
  57.     if(damagedid != INVALID_PLAYER_ID)
  58.     {
  59.         GetPlayerHealth(damagedid,Ex_HP);
  60.         GetPlayerArmour(damagedid,Ex_AP);
  61.         if(Ex_AP != Ex_Armour[damagedid]) Ret_APLost = (Ex_Armour[damagedid]-Ex_AP);
  62.         if(Ex_HP != Ex_PHealth[damagedid]) Ret_HPLost = (Ex_PHealth[damagedid]-Ex_HP);
  63.         Ex_PHealth[damagedid]=Ex_HP;
  64.         Ex_Armour[damagedid]=Ex_AP;
  65.     }
  66.     return CallLocalFunction("Ex_OnPlayerGiveDamage","iiffi" ,playerid,damagedid,Ret_HPLost,Ret_APLost,weaponid);
  67.  
  68. }
  69. #if defined _ALS_OnPlayerGiveDamage
  70.     #undef OnPlayerGiveDamage
  71. #else
  72.     #define _ALS_OnPlayerGiveDamage
  73. #endif
  74. #define OnPlayerGiveDamage Ex_OnPlayerGiveDamage
  75. forward Ex_OnPlayerGiveDamage(playerid, damagedid, Float:HealthLost,Float:ArmourLost, weaponid);
  76.  
  77. #if !defined FILTERSCRIPT
  78.     // OnGameModeInit
  79.     public OnGameModeInit()
  80.     {
  81.         Ex_OPU = (funcidx("Ex_OnPlayerUpdate") != -1);
  82.         return (funcidx("Ex_OnGameModeInit") != -1)?CallLocalFunction("Ex_OnGameModeInit",""):1;
  83.     }
  84.     #if defined _ALS_OnGameModeInit
  85.         #undef OnGameModeInit
  86.     #else
  87.         #define _ALS_OnGameModeInit
  88.     #endif
  89.     #define OnGameModeInit Ex_OnGameModeInit
  90. #else
  91.     // OnFilterScriptInit
  92.     public OnFilterScriptInit()
  93.     {
  94.         Ex_OPU = (funcidx("Ex_OnPlayerUpdate") != -1);
  95.         return (funcidx("Ex_OnFilterScriptInit") != -1)?CallLocalFunction("Ex_OnFilterScriptInit",""):1;
  96.     }
  97.     #if defined _ALS_OnFilterScriptInit
  98.         #undef OnFilterScriptInit
  99.     #else
  100.         #define _ALS_OnFilterScriptInit
  101.     #endif
  102.     #define OnFilterScriptInit Ex_OnFilterScriptInit
  103.     forward Ex_OnFilterScriptInit();
  104. #endif
  105.  
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement