Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. findplayer("Carlito").addweapon(name);
  2. //#CLIENTSIDE
  3. function onCreated() {
  4. CoolDown = this;
  5. player.onCoolDownDecrease();
  6. }
  7.  
  8. public function onStartCoolDown(temp.data) {
  9. if(findHotKey(temp.data) == false) return;
  10. temp.keyid = findHotKey(temp.data);
  11. temp.ctrl = makevar("HUD_Actions_" @temp.keyid);
  12. drawCoolDown(temp.ctrl);
  13. }
  14.  
  15. function findHotKey(temp.data) {
  16. temp.keys = getstringkeys("client.hotkeys.");
  17. for(temp.key : temp.keys) {
  18. if(client.hotkeys.(@ temp.key )[1] == temp.data)
  19. return temp.key;
  20. }
  21. return false;
  22. }
  23.  
  24. function drawCoolDown(temp.ctrl) {
  25. makevar("OL_"@temp.ctrl.name).destroy();
  26. this.clOverlay = new GuiShowImgCtrl("OL_"@temp.ctrl.name);
  27. with(this.clOverlay) {
  28. this.red = 0;
  29. this.green = 0;
  30. this.blue = 0;
  31. useownprofile = true;
  32. profile.modal = false;
  33.  
  34. this.alpha = 0.75;
  35. this.image = "chest.png";
  36. }
  37. this.clOverlayText = new GuiMLTextCtrl("OLText_"@temp.ctrl.name);
  38. with(this.clOverlayText) {
  39. useownprofile = true;
  40. profile.modal = false;
  41. this.alpha = 0.75;
  42. this.text = 4;
  43. }
  44. this.clOverlay.show();
  45. this.clOverlayText.show();
  46. temp.ctrl.addcontrol(this.clOverlay);
  47. temp.ctrl.addcontrol(this.clOverlayText);
  48. temp.cooldownguis.add(this.clOverlayText);
  49. this.cooldownProgress = 1;
  50. this.trigger("onTimeout", null);
  51. }
  52.  
  53.  
  54.  
  55. function onTimeout() {
  56.  
  57. this.clImage = this.clOverlay.showimg;
  58. this.cooldownProgress -= 0.008;
  59. if (this.cooldownProgress < 0) return;
  60.  
  61. this.clImage.polygon = this.getCooldownPolygon(this.cooldownProgress);
  62. for (temp.i = 0; temp.i < this.clImage.polygon.size(); temp.i += 2) {
  63. this.clImage.polygon[temp.i + 0] *= 32;
  64. this.clImage.polygon[temp.i + 0] += this.clOverlay.x;
  65.  
  66. this.clImage.polygon[temp.i + 1] *= 32;
  67. this.clImage.polygon[temp.i + 1] += this.clOverlay.y;
  68. }
  69. setTimer(0.05);
  70. }
  71.  
  72. function getCooldownPolygon(temp.progress) {
  73. temp.angleInDegrees = temp.progress * 360;
  74.  
  75. if (temp.angleInDegrees <= 0) return null;
  76. if (temp.angleInDegrees >= 360) return {0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0};
  77.  
  78. temp.polygon = {
  79. 0.5, 0.5,
  80. 0.5, 0.0
  81. };
  82.  
  83. temp.a = degtorad(90 + temp.angleInDegrees);
  84. temp.dx = +cos(temp.a);
  85. temp.dy = -sin(temp.a);
  86.  
  87. if (temp.angleInDegrees > 0) {
  88. if (temp.angleInDegrees < 45) {
  89. temp.polygon.add(0.5 - (temp.dx/temp.dy) * 0.5);
  90. temp.polygon.add(0);
  91. } else {
  92. temp.polygon.add(0.0);
  93. temp.polygon.add(0.0);
  94. }
  95. }
  96.  
  97. if (temp.angleInDegrees >= 45) {
  98. if (temp.angleInDegrees < 135) {
  99. temp.polygon.add(0.0);
  100. temp.polygon.add(0.5 - (temp.dy/temp.dx) * 0.5);
  101. } else {
  102. temp.polygon.add(0.0);
  103. temp.polygon.add(1.0);
  104. }
  105. }
  106.  
  107. if (temp.angleInDegrees >= 135) {
  108. if (temp.angleInDegrees < 225) {
  109. temp.polygon.add(0.5 + (temp.dx/temp.dy) * 0.5);
  110. temp.polygon.add(1.0);
  111. } else {
  112. temp.polygon.add(1.0);
  113. temp.polygon.add(1.0);
  114. }
  115. }
  116.  
  117. if (temp.angleInDegrees >= 225) {
  118. if (temp.angleInDegrees < 315) {
  119. temp.polygon.add(1.0);
  120. temp.polygon.add(0.5 + (temp.dy/temp.dx) * 0.5);
  121. } else {
  122. temp.polygon.add(1.0);
  123. temp.polygon.add(0.0);
  124. }
  125. }
  126.  
  127. if (temp.angleInDegrees >= 315) {
  128. if (temp.angleInDegrees < 360) {
  129. temp.polygon.add(0.5 - (temp.dx/temp.dy) * 0.5);
  130. temp.polygon.add(0.0);
  131. } else {
  132. temp.polygon.add(0.5);
  133. temp.polygon.add(0.0);
  134. }
  135. }
  136. return temp.polygon;
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement