Advertisement
Guest User

OPTDex v1.1

a guest
Sep 25th, 2011
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.36 KB | None | 0 0
  1. /********************************************
  2.  * OnPlayerTakeDamage(Ex)! V1.1             *
  3.  * Credits: wups                            *
  4.  ********************************************/
  5.  
  6. #include <a_samp>
  7. #tryinclude <foreach>
  8.  
  9. #if !defined foreach
  10.     #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  11.     #define __SSCANF_FOREACH__
  12. #endif
  13.  
  14. static
  15.     Float:Ex_PHealth[MAX_PLAYERS],
  16.     Float:Ex_Armour[MAX_PLAYERS],
  17.     Ex_Timer;
  18.    
  19. forward Ex_SecTimer();
  20. public Ex_SecTimer()
  21. {
  22.     foreach(Player, i)
  23.     {
  24.         GetPlayerHealth(i,Ex_PHealth[i]);
  25.         GetPlayerArmour(i,Ex_Armour[i]);
  26.     }
  27.     return 1;
  28. }
  29. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
  30. {
  31.     new
  32.         Float:Ex_HP,
  33.         Float:Ex_AP,
  34.         Float:Ret_HPLost,
  35.         Float:Ret_APLost;
  36.     GetPlayerHealth(playerid,Ex_HP);
  37.     GetPlayerArmour(playerid,Ex_AP);
  38.     if(Ex_AP != Ex_Armour[playerid]) Ret_APLost = (Ex_Armour[playerid]-Ex_AP);
  39.     if(Ex_HP != Ex_PHealth[playerid]) Ret_HPLost = (Ex_PHealth[playerid]-Ex_HP);
  40.     Ex_PHealth[playerid]=Ex_HP;
  41.     Ex_Armour[playerid]=Ex_AP;
  42.     return CallLocalFunction("Ex_OnPlayerTakeDamage","iiffi",playerid,issuerid,Ret_HPLost,Ret_APLost,weaponid);
  43. }
  44. #if defined _ALS_OnPlayerTakeDamage
  45.     #undef OnPlayerTakeDamage
  46. #else
  47.     #define _ALS_OnPlayerTakeDamage
  48. #endif
  49. #define OnPlayerTakeDamage Ex_OnPlayerTakeDamage
  50. forward Ex_OnPlayerTakeDamage(playerid, issuerid, Float:HealthLost,Float:ArmourLost, weaponid);
  51.  
  52.  
  53.  
  54. #if !defined FILTERSCRIPT
  55.     // OnGameModeInit
  56.     public OnGameModeInit()
  57.     {
  58.         Ex_Timer = SetTimer("Ex_SecTimer",998,true);
  59.         return (funcidx("Ex_OnGameModeInit") != -1)?CallLocalFunction("Ex_OnGameModeInit",""):1;
  60.     }
  61.     #if defined _ALS_OnGameModeInit
  62.         #undef OnGameModeInit
  63.     #else
  64.         #define _ALS_OnGameModeInit
  65.     #endif
  66.     #define OnGameModeInit Ex_OnGameModeInit
  67.     forward Ex_OnGameModeInit();
  68.     public OnGameModeExit()
  69.     {
  70.         KillTimer(Ex_Timer);
  71.         return (funcidx("Ex_OnGameModeExit") != -1)?CallLocalFunction("Ex_OnGameModeInit",""):1;
  72.     }
  73. #else
  74.     // OnFilterScriptInit
  75.     public OnFilterScriptInit()
  76.     {
  77.         SetTimer("Ex_SecTimer",998,true);
  78.         return (funcidx("Ex_OnFilterScriptInit") != -1)?CallLocalFunction("Ex_OnFilterScriptInit",""):1;
  79.     }
  80.     #if defined _ALS_OnFilterScriptInit
  81.         #undef OnFilterScriptInit
  82.     #else
  83.         #define _ALS_OnFilterScriptInit
  84.     #endif
  85.     #define OnFilterScriptInit Ex_OnFilterScriptInit
  86.     forward Ex_OnFilterScriptInit();
  87. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement