Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Loadout (bn)
- @persist Preset:string CW:array M9K:array IsAlive MyBox:entity NeedToSpawnBox
- if(first()) {
- runOnLast(1)
- runOnWeaponSwitch(1)
- Preset = "cw" #Takes "cw" or "m9k"
- #Example weapon array below
- #M9K = array("weapon_medkit","m9k_acr","m9k_ak47","m9k_g36","m9k_aw50")
- M9K = array("m9k_ak74","m9k_g3a3","m9k_g36","m9k_m416")
- concmd("gm_giveswep "+Weapons[I,string])
- #Who needs entSpawn anyway?
- function void initBox() {
- concmd("gm_spawnsent cw_ammo_crate_regular")
- findByClass("cw_ammo_crate_regular")
- MyBox = findClosest(owner():aimPos())
- NeedToSpawnBox = 0
- }
- function void findBoxes() {
- findByClass("cw_ammo_crate_regular")
- local Boxes = findToArray()
- if(Boxes:count() > 0) {
- MyBox = Boxes[1,entity]
- NeedToSpawnBox = 0
- }
- else {
- NeedToSpawnBox = 1
- }
- }
- }
- IsAlive = owner():isAlive()
- # I love this next piece. <3
- timer("findbox",10000)
- if(clk("findbox") | first() & Preset:lower() == "cw") {
- findBoxes()
- }
- if(NeedToSpawnBox & Preset:lower() == "cw") {
- if(owner():vel():length() <= 5) {
- local Dist = owner():pos():distance(owner():aimPos())
- if(Dist > 25 & Dist < 1500) {
- initBox()
- }
- }
- }
- if(MyBox:isValid() & MyBox:owner() == owner()) {
- if(MyBox:getAlpha() != 0) {
- MyBox:setAlpha(0)
- noCollideAll(MyBox,1)
- }
- }
- if($IsAlive == 1) {
- if(Preset:lower() == "cw") {
- local Str = ""
- for(I=1,CW:count()) {
- Str = Str+"gm_giveswep "+CW[I,string]+";"
- }
- concmd(Str)
- }
- elseif(Preset:lower() == "m9k") {
- local Str = ""
- for(I=1,M9K:count()) {
- Str = Str+"gm_giveswep "+M9K[I,string]+";"
- }
- concmd(Str)
- }
- }
- #This part isn't supposed to be legible, I feel bad if you're trying to read this.
- #Getting more cw ammo automatically
- if(Preset:lower() == "cw") {
- local CurWep = owner():weapon():type():explode("_")
- if(CurWep[1,string] == "cw") {
- if(owner():weapon():primaryAmmoType() == ".338 Lapua") {
- if(owner():ammoCount(owner():weapon():primaryAmmoType()) < 30) {
- MyBox:use()
- }
- }
- else {
- if(owner():ammoCount(owner():weapon():primaryAmmoType()) < 150) {
- MyBox:use()
- }
- }
- }
- }
- timer("gimmeammo",1000)
- #hit me up if you want me to make this legible.
- #Getting more m9k ammo automatically
- if(Preset:lower() == "m9k") {
- local CurWep = owner():weapon():type():explode("_")
- if(CurWep[1,string] == "m9k") {
- if(clk("gimmeammo")) {
- if(owner():ammoCount(owner():weapon():primaryAmmoType()) < 200 & owner():weapon():primaryAmmoType() != "SniperPenetratedRound") {
- local AmmoType = owner():weapon():primaryAmmoType()
- if(AmmoType == "AR2") {
- concmd("gm_spawnsent m9k_ammo_ar2")
- findByClass("m9k_ammo_ar2")
- local Box = findClosest(owner():aimPos())
- Box:use()
- }
- }
- elseif(owner():ammoCount(owner():weapon():primaryAmmoType()) <= 50 & owner():weapon():primaryAmmoType() == "SniperPenetratedRound") {
- concmd("gm_spawnsent m9k_ammo_sniper_rounds")
- findByClass("m9k_ammo_sniper_rounds")
- local Box = findClosest(owner():aimPos())
- Box:use()
- }
- }
- }
- }
- interval(300)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement