SHARE
TWEET

Untitled

a guest Aug 19th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @name Loadout (bn)
  2. @persist Preset:string CW:array M9K:array IsAlive MyBox:entity NeedToSpawnBox
  3. if(first()) {
  4.     runOnLast(1)
  5.     runOnWeaponSwitch(1)
  6.     Preset = "cw" #Takes "cw" or "m9k"
  7.     #Example weapon array below
  8.     #M9K = array("weapon_medkit","m9k_acr","m9k_ak47","m9k_g36","m9k_aw50")
  9.     M9K = array("m9k_ak74","m9k_g3a3","m9k_g36","m9k_m416")
  10.      concmd("gm_giveswep "+Weapons[I,string])
  11.     #Who needs entSpawn anyway?
  12.     function void initBox() {
  13.         concmd("gm_spawnsent cw_ammo_crate_regular")
  14.         findByClass("cw_ammo_crate_regular")
  15.         MyBox = findClosest(owner():aimPos())
  16.         NeedToSpawnBox = 0
  17.     }
  18.     function void findBoxes() {
  19.         findByClass("cw_ammo_crate_regular")
  20.         local Boxes = findToArray()
  21.         if(Boxes:count() > 0) {
  22.             MyBox = Boxes[1,entity]
  23.             NeedToSpawnBox = 0
  24.         }
  25.         else {
  26.             NeedToSpawnBox = 1
  27.         }
  28.     }
  29. }
  30. IsAlive = owner():isAlive()
  31.  
  32. # I love this next piece. <3
  33.  
  34. timer("findbox",10000)
  35. if(clk("findbox") | first() & Preset:lower() == "cw") {
  36.     findBoxes()
  37. }
  38.  
  39.  
  40. if(NeedToSpawnBox & Preset:lower() == "cw") {
  41.     if(owner():vel():length() <= 5) {
  42.         local Dist = owner():pos():distance(owner():aimPos())
  43.         if(Dist > 25 & Dist < 1500) {
  44.             initBox()
  45.         }
  46.     }
  47. }
  48.  
  49. if(MyBox:isValid() & MyBox:owner() == owner()) {
  50.     if(MyBox:getAlpha() != 0) {
  51.         MyBox:setAlpha(0)
  52.         noCollideAll(MyBox,1)
  53.     }
  54. }
  55.  
  56.  
  57.  
  58.  
  59. if($IsAlive == 1) {
  60.     if(Preset:lower() == "cw") {
  61.         local Str = ""
  62.         for(I=1,CW:count()) {
  63.             Str = Str+"gm_giveswep "+CW[I,string]+";"
  64.         }
  65.         concmd(Str)
  66.     }
  67.     elseif(Preset:lower() == "m9k") {
  68.         local Str = ""
  69.         for(I=1,M9K:count()) {
  70.             Str = Str+"gm_giveswep "+M9K[I,string]+";"
  71.         }
  72.         concmd(Str)
  73.     }
  74. }
  75. #This part isn't supposed to be legible, I feel bad if you're trying to read this.
  76. #Getting more cw ammo automatically
  77. if(Preset:lower() == "cw") {
  78.     local CurWep = owner():weapon():type():explode("_")
  79.     if(CurWep[1,string] ==  "cw") {
  80.         if(owner():weapon():primaryAmmoType() == ".338 Lapua") {
  81.             if(owner():ammoCount(owner():weapon():primaryAmmoType()) < 30) {
  82.                 MyBox:use()
  83.             }
  84.         }
  85.         else {
  86.             if(owner():ammoCount(owner():weapon():primaryAmmoType()) < 150) {
  87.                 MyBox:use()
  88.             }
  89.         }  
  90.     }
  91. }
  92. timer("gimmeammo",1000)
  93.  
  94. #hit me up if you want me to make this legible.
  95. #Getting more m9k ammo automatically
  96. if(Preset:lower() == "m9k") {
  97.     local CurWep = owner():weapon():type():explode("_")
  98.     if(CurWep[1,string] == "m9k") {
  99.         if(clk("gimmeammo")) {
  100.             if(owner():ammoCount(owner():weapon():primaryAmmoType()) < 200 & owner():weapon():primaryAmmoType() != "SniperPenetratedRound") {
  101.                 local AmmoType = owner():weapon():primaryAmmoType()
  102.                 if(AmmoType == "AR2")  {
  103.                         concmd("gm_spawnsent m9k_ammo_ar2")
  104.                         findByClass("m9k_ammo_ar2")
  105.                         local Box = findClosest(owner():aimPos())
  106.                         Box:use()
  107.                 }
  108.             }
  109.             elseif(owner():ammoCount(owner():weapon():primaryAmmoType()) <= 50 & owner():weapon():primaryAmmoType() == "SniperPenetratedRound") {
  110.                 concmd("gm_spawnsent m9k_ammo_sniper_rounds")
  111.                 findByClass("m9k_ammo_sniper_rounds")
  112.                 local Box = findClosest(owner():aimPos())
  113.                 Box:use()
  114.             }
  115.         }
  116.     }
  117. }
  118.  
  119. interval(300)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top