Advertisement
Guest User

Damage indicator / Wizzard2H

a guest
Feb 8th, 2016
1,188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.21 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new hit[MAX_PLAYERS];
  4. new hit1[MAX_PLAYERS];
  5. new Float:damage2[MAX_PLAYERS];
  6. new Float:damage1[MAX_PLAYERS];
  7. new timerdamage[MAX_PLAYERS];
  8. new timerdamage1[MAX_PLAYERS];
  9. new PlayerText:Indicator[MAX_PLAYERS];
  10. new PlayerText:IndicatorBox[MAX_PLAYERS];
  11. new PlayerText:Indicator1[MAX_PLAYERS];
  12. new PlayerText:IndicatorBox1[MAX_PLAYERS];
  13.  
  14. public OnFilterScriptInit()
  15. {
  16.     print("\n Hit Indicator");
  17.     return 1;
  18. }
  19. public OnFilterScriptExit()
  20. {
  21.     print("\n Hit Indicator unloaded");
  22.     return 1;
  23. }
  24. public OnPlayerConnect(playerid)
  25. {
  26. CreatePlayerTD(playerid);
  27. return 1;
  28. }
  29. public OnPlayerDisconnect(playerid)
  30. {
  31. DeleteTDS(playerid);
  32. return 1;
  33. }
  34. public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
  35. {
  36.     if(timerdamage1[playerid] != 0) KillTimer(timerdamage1[playerid]);
  37.  
  38.     hit1[playerid]++;
  39.     damage1[playerid] += amount;
  40.  
  41.     timerdamage1[playerid] = SetTimerEx("DamageReset1", 3000, 0, "i", playerid);
  42.  
  43.     PlayerTextDrawShow(playerid, IndicatorBox1[playerid]);
  44.     PlayerTextDrawShow(playerid, Indicator1[playerid]);
  45.  
  46.     new str[50];
  47.     format(str,sizeof(str)," DAMAGE: %d hit(s) %.0f dmg", hit1[playerid], damage1[playerid]);
  48.     PlayerTextDrawSetString(playerid, Indicator1[playerid], str);
  49.     return 1;
  50.  }
  51. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  52. {
  53.         if(timerdamage[playerid] != 0) KillTimer(timerdamage[playerid]);
  54.  
  55.         hit[playerid]++;
  56.         damage2[playerid] += amount;
  57.  
  58.         timerdamage[playerid] = SetTimerEx("DamageReset", 3000, 0, "i", playerid);
  59.  
  60.         PlayerTextDrawShow(playerid, IndicatorBox[playerid]);
  61.         PlayerTextDrawShow(playerid, Indicator[playerid]);
  62.  
  63.         new str[50];
  64.         format(str,sizeof(str),"HIT: %d hit(s) %.0f dmg", hit[playerid], damage2[playerid]);
  65.         PlayerTextDrawSetString(playerid, Indicator[playerid], str);
  66.         return 1;
  67. }
  68. forward DamageReset(playerid);
  69. public DamageReset(playerid)
  70. {
  71.     hit[playerid] = 0;
  72.     damage2[playerid] = 0;
  73.     PlayerTextDrawHide(playerid, IndicatorBox[playerid]);
  74.     PlayerTextDrawHide(playerid, Indicator[playerid]);
  75.     KillTimer(timerdamage[playerid]);
  76.     return 1;
  77. }
  78. forward DamageReset1(playerid);
  79. public DamageReset1(playerid)
  80. {
  81.     hit1[playerid] = 0;
  82.     damage1[playerid] = 0;
  83.     PlayerTextDrawHide(playerid, IndicatorBox1[playerid]);
  84.     PlayerTextDrawHide(playerid, Indicator1[playerid]);
  85.     KillTimer(timerdamage1[playerid]);
  86.     return 1;
  87. }
  88. stock CreatePlayerTD(playerid)
  89. {
  90.         IndicatorBox[playerid] = CreatePlayerTextDraw(playerid, 428.444458, 398.753326, "usebox");
  91.         PlayerTextDrawLetterSize(playerid, IndicatorBox[playerid], 0.000000, -2.584319);
  92.         PlayerTextDrawTextSize(playerid, IndicatorBox[playerid], 622.444458, 0.000000);
  93.         PlayerTextDrawAlignment(playerid, IndicatorBox[playerid], 1);
  94.         PlayerTextDrawColor(playerid, IndicatorBox[playerid], 0);
  95.         PlayerTextDrawUseBox(playerid, IndicatorBox[playerid], true);
  96.         PlayerTextDrawBoxColor(playerid, IndicatorBox[playerid], 102);
  97.         PlayerTextDrawSetShadow(playerid, IndicatorBox[playerid], 0);
  98.         PlayerTextDrawFont(playerid, IndicatorBox[playerid], 0);
  99.  
  100.         Indicator[playerid] = CreatePlayerTextDraw(playerid, 540.000183, 380.826660, "Hit: 4 - 150 dmg");
  101.         PlayerTextDrawLetterSize(playerid, Indicator[playerid], 0.227333, 1.346132);
  102.         PlayerTextDrawAlignment(playerid, Indicator[playerid], 1);
  103.         PlayerTextDrawColor(playerid, Indicator[playerid], -1);
  104.         PlayerTextDrawSetShadow(playerid, Indicator[playerid], 0);
  105.         PlayerTextDrawSetOutline(playerid, Indicator[playerid], 1);
  106.         PlayerTextDrawBackgroundColor(playerid, Indicator[playerid], 51);
  107.         PlayerTextDrawFont(playerid, Indicator[playerid], 1);
  108.         PlayerTextDrawSetProportional(playerid, Indicator[playerid], 1);
  109.  
  110.         IndicatorBox1[playerid] = CreatePlayerTextDraw(playerid, 428.444458, 382.753326, "usebox");
  111.         PlayerTextDrawLetterSize(playerid, IndicatorBox1[playerid], 0.000000, -2.584319);
  112.         PlayerTextDrawTextSize(playerid, IndicatorBox1[playerid], 622.444458, 0.000000);
  113.         PlayerTextDrawAlignment(playerid, IndicatorBox1[playerid], 1);
  114.         PlayerTextDrawColor(playerid, IndicatorBox1[playerid], 0);
  115.         PlayerTextDrawUseBox(playerid, IndicatorBox1[playerid], true);
  116.         PlayerTextDrawBoxColor(playerid, IndicatorBox1[playerid], 102);
  117.         PlayerTextDrawSetShadow(playerid, IndicatorBox1[playerid], 0);
  118.         PlayerTextDrawFont(playerid, IndicatorBox1[playerid], 0);
  119.  
  120.         Indicator1[playerid] = CreatePlayerTextDraw(playerid, 430.000183, 363.826660, "Hit: 4 - 150 dmg");
  121.         PlayerTextDrawLetterSize(playerid, Indicator1[playerid], 0.227333, 1.346132);
  122.         PlayerTextDrawAlignment(playerid, Indicator1[playerid], 1);
  123.         PlayerTextDrawColor(playerid, Indicator1[playerid], -1);
  124.         PlayerTextDrawSetShadow(playerid, Indicator1[playerid], 0);
  125.         PlayerTextDrawSetOutline(playerid, Indicator1[playerid], 1);
  126.         PlayerTextDrawBackgroundColor(playerid, Indicator1[playerid], 51);
  127.         PlayerTextDrawFont(playerid, Indicator1[playerid], 1);
  128.         PlayerTextDrawSetProportional(playerid, Indicator1[playerid], 1);
  129.  
  130.         return 1;
  131. }
  132. stock DeleteTDS(playerid)
  133. {
  134.     PlayerTextDrawHide(playerid,Indicator1[playerid]);
  135.     PlayerTextDrawDestroy(playerid,IndicatorBox1[playerid]);
  136.     PlayerTextDrawHide(playerid,Indicator[playerid]);
  137.     PlayerTextDrawDestroy(playerid,IndicatorBox[playerid]);
  138.     return 1;
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement