Advertisement
Ultranite

Untitled

Dec 11th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. var local = Entity.GetLocalPlayer();
  2. var wepList = {
  3. 0: "SMG",
  4. 1: "Heavy Pistol",
  5. };
  6. runTime = Global.Curtime();
  7. var secondsElapsed = 0;
  8. var waiting = 0;
  9. setup();
  10.  
  11. function weaponType() {
  12. weapon = Entity.GetName(Entity.GetWeapon(local));
  13. weapons = {
  14. "r8 revolver": "Heavy Pistol",
  15. "desert eagle": "Heavy Pistol",
  16. "mp9": "SMG",
  17. "mac 10": "SMG",
  18. "ump 45": "SMG",
  19. "p90": "SMG",
  20. "pp bizon": "SMG",
  21. "mp7": "SMG",
  22. "mp5 sd": "SMG"
  23. };
  24. return weapons[weapon];
  25. }
  26.  
  27. function inAir() {
  28. if (!UI.GetValue("Script items", "[IAHC] Enable In-Air Hitchance"))
  29. return;
  30. if (weaponType() == undefined)
  31. return;
  32. wep = weaponType().toUpperCase();
  33. if (wep == "SMG")
  34. wep = "GENERAL";
  35. fv = Entity.GetProp(local, "CBasePlayer", "m_flFallVelocity");
  36. inAirHC = UI.GetValue("Script items", "[IAHC] " + weaponType() + " In-Air Hitchance");
  37. baseHC = UI.GetValue("Script items", "[IAHC] " + weaponType() + " Base Hitchance");
  38. if (fv < 1 && fv > -1) {
  39. if (waiting == 1 && secondsElapsed < 10) {
  40. UI.SetValue("Rage", wep, "Accuracy", "Hitchance", baseHC - 30);
  41. } else {
  42. UI.SetValue("Rage", wep, "Accuracy", "Hitchance", baseHC);
  43. waiting = 0;
  44. secondsElapsed = 0;
  45. }
  46. } else {
  47. UI.SetValue("Rage", wep, "Accuracy", "Hitchance", baseHC);
  48. waiting = 1;
  49. }
  50. }
  51.  
  52. function drawInMenu() {
  53. if (!UI.GetValue("Script items", "[IAHC] Enable In-Air Hitchance")) {
  54. UI.SetEnabled("Script items", "[IAHC] Enabled Weapons", false);
  55. UI.SetEnabled("Script items", "[IAHC] Weapon Config", false);
  56. return;
  57. }
  58. UI.SetEnabled("Script items", "[IAHC] Enabled Weapons", true);
  59. UI.SetEnabled("Script items", "[IAHC] Weapon Config", true);
  60. enabled = UI.GetValue("Script items", "[IAHC] Enabled Weapons");
  61. currWep = UI.GetString("Script items", "[IAHC] Weapon Config");
  62. showHvyPistol = ((enabled == 1 || enabled == 3) && currWep == "Heavy Pistol") ? true : false;
  63. showSMG = ((enabled == 2 || enabled == 3) && currWep == "SMG") ? true : false;
  64. UI.SetEnabled("Script items", "[IAHC] Heavy Pistol Base Hitchance", showHvyPistol);
  65. UI.SetEnabled("Script items", "[IAHC] Heavy Pistol In-Air Hitchance", showHvyPistol);
  66. UI.SetEnabled("Script items", "[IAHC] SMG Base Hitchance", showSMG);
  67. UI.SetEnabled("Script items", "[IAHC] SMG In-Air Hitchance", showSMG);
  68. }
  69.  
  70. function setup() {
  71. UI.AddCheckbox("[IAHC] Enable In-Air Hitchance");
  72. UI.AddMultiDropdown("[IAHC] Enabled Weapons", ["Heavy Pistol", "SMG"]);
  73. UI.AddDropdown("[IAHC] Weapon Config", ["Heavy Pistol", "SMG"]);
  74. UI.SetEnabled("Script items", "[IAHC] Enabled Weapons", false);
  75. UI.SetEnabled("Script items", "[IAHC] Weapon Config", false);
  76. for (wep in wepList) {
  77. UI.AddSliderInt("[IAHC] " + wepList[wep] + " Base Hitchance", 0, 100);
  78. UI.AddSliderInt("[IAHC] " + wepList[wep] + " In-Air Hitchance", 0, 100);
  79. UI.SetEnabled("Script items", "[IAHC] " + wepList[wep] + " In-Air Hitchance", false);
  80. UI.SetEnabled("Script items", "[IAHC] " + wepList[wep] + " Base Hitchance", false);
  81. }
  82. }
  83.  
  84. function check() {
  85. if (waiting == 1) {
  86. if (Global.Curtime() - runTime > .1) {
  87. runTime = Global.Curtime();
  88. secondsElapsed += 1;
  89. }
  90. }
  91. }
  92. Global.RegisterCallback("Draw", "drawInMenu");
  93. Global.RegisterCallback("Draw", "check");
  94. Global.RegisterCallback("Draw", "inAir");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement