Guest User

Untitled

a guest
Aug 10th, 2014
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3.  
  4. new hit[MAX_PLAYERS];
  5. new Float:damage[MAX_PLAYERS];
  6. new timerdamage[MAX_PLAYERS];
  7. new PlayerText:Indicator[MAX_PLAYERS];
  8. new PlayerText:IndicatorBox[MAX_PLAYERS];
  9.  
  10. public OnPlayerConnect(playerid)
  11. {
  12. IndicatorBox[playerid] = CreatePlayerTextDraw(playerid, 538.444458, 392.753326, "usebox");
  13. PlayerTextDrawLetterSize(playerid, IndicatorBox[playerid], 0.000000, -2.584319);
  14. PlayerTextDrawTextSize(playerid, IndicatorBox[playerid], 622.444458, 0.000000);
  15. PlayerTextDrawAlignment(playerid, IndicatorBox[playerid], 1);
  16. PlayerTextDrawColor(playerid, IndicatorBox[playerid], 0);
  17. PlayerTextDrawUseBox(playerid, IndicatorBox[playerid], true);
  18. PlayerTextDrawBoxColor(playerid, IndicatorBox[playerid], 102);
  19. PlayerTextDrawSetShadow(playerid, IndicatorBox[playerid], 0);
  20. PlayerTextDrawFont(playerid, IndicatorBox[playerid], 0);
  21.  
  22. Indicator[playerid] = CreatePlayerTextDraw(playerid, 540.000183, 374.826660, "Hit: 4 - 150 dmg");
  23. PlayerTextDrawLetterSize(playerid, Indicator[playerid], 0.227333, 1.346132);
  24. PlayerTextDrawAlignment(playerid, Indicator[playerid], 1);
  25. PlayerTextDrawColor(playerid, Indicator[playerid], -1);
  26. PlayerTextDrawSetShadow(playerid, Indicator[playerid], 0);
  27. PlayerTextDrawSetOutline(playerid, Indicator[playerid], 1);
  28. PlayerTextDrawBackgroundColor(playerid, Indicator[playerid], 51);
  29. PlayerTextDrawFont(playerid, Indicator[playerid], 1);
  30. PlayerTextDrawSetProportional(playerid, Indicator[playerid], 1);
  31. return 1;
  32. }
  33.  
  34. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
  35. {
  36. if(issuerid != INVALID_PLAYER_ID)
  37. {
  38. if(timerdamage[playerid] != 0) KillTimer(timerdamage[playerid]);
  39.  
  40. hit[playerid]++;
  41. damage[playerid] += amount;
  42.  
  43. timerdamage[playerid] = SetTimerEx("DamageReset", 3000, 0, "i", playerid);
  44.  
  45. PlayerTextDrawShow(playerid, IndicatorBox[playerid]);
  46. PlayerTextDrawShow(playerid, Indicator[playerid]);
  47.  
  48. new str[20];
  49. format(str,sizeof(str),"%d hit(s) %.0f dmg", hit[playerid], damage[playerid]);
  50. PlayerTextDrawSetString(playerid, Indicator[playerid], str);
  51. }
  52. return 1;
  53. }
  54.  
  55. forward DamageReset(playerid);
  56. public DamageReset(playerid)
  57. {
  58. hit[playerid] = 0;
  59. damage[playerid] = 0;
  60. PlayerTextDrawHide(playerid, IndicatorBox[playerid]);
  61. PlayerTextDrawHide(playerid, Indicator[playerid]);
  62. KillTimer(timerdamage[playerid]);
  63. return 1;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment