diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/!Helpers.lua b/beatrun/gamemodes/beatrun/gamemode/sh/!Helpers.lua index 1da2a05..51a133b 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/!Helpers.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/!Helpers.lua @@ -1,6 +1,9 @@ local vmatrixmeta = FindMetaTable("VMatrix") local playermeta = FindMetaTable("Player") +CreateConVar("Beatrun_RandomMWLoadouts", 0, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) +CreateConVar("Beatrun_RandomARC9Loadouts", 0, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) + BEATRUN_GAMEMODES_LOADOUTS = { {"weapon_357", "weapon_ar2"} } @@ -86,4 +89,28 @@ function playermeta:notUsingRH(wep) else return false end -end \ No newline at end of file +end + +function getRandomMGBaseSWEP() + local allWep = weapons.GetList() + local wepIndex = math.random(#allWep) + local wep = allWep[wepIndex] + + if wep.Base == "mg_base" and not wep.AdminOnly then + return wep + else + return getRandomMGBaseSWEP() + end +end + +function getRandomARC9SWEP() + local allWep = weapons.GetList() + local wepIndex = math.random(#allWep) + local wep = allWep[wepIndex] + + if wep.Base == "arc9_cod2019_base" and not wep.AdminOnly then + return wep + else + return getRandomARC9SWEP() + end +end diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua b/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua index 717bb0f..a4fe1d3 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua @@ -22,17 +22,24 @@ if SERVER then v:Spawn() end - if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then + if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() and not GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() then for i = 0, 1 do - local randomSWEP = getRandomMGBaseWeapon() - local w = v:Give(randomSWEP.ClassName) + local swep = getRandomMGBaseSWEP() + local w = v:Give(swep.ClassName) timer.Simple(1, function() if w:GetPrimaryAmmoType() ~= -1 then v:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end if w:GetSecondaryAmmoType() ~= -1 then v:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end end) end - else + elseif GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() and not GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then + for i = 0, 1 do + -- We don't need ammo because ARC9 got the infinite ammo option! + + local swep = getRandomARC9SWEP() + v:Give(swep.ClassName) + end + elseif not GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() and not GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then for _, b in ipairs(BEATRUN_GAMEMODES_LOADOUTS[math.random(#BEATRUN_GAMEMODES_LOADOUTS)]) do local w = v:Give(b) diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua index a2a9401..700326a 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua @@ -2,20 +2,6 @@ if SERVER then util.AddNetworkString("Deathmatch_Start") util.AddNetworkString("Deathmatch_Sync") - CreateConVar("Beatrun_RandomMWLoadouts", 0, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) - - function getRandomMGBaseWeapon() - local allWep = weapons.GetList() - local wepIndex = math.random(#allWep) - local wep = allWep[wepIndex] - - if wep.Base == "mg_base" and not wep.AdminOnly then - return wep - else - return getRandomMGBaseWeapon() - end - end - function Beatrun_StartDeathmatch() if GetGlobalBool("GM_DEATHMATCH") then return end if Course_Name ~= "" then return end @@ -31,17 +17,24 @@ if SERVER then v:Spawn() end - if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then + if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() and not GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() then for i = 0, 1 do - local randomSWEP = getRandomMGBaseWeapon() - local w = v:Give(randomSWEP.ClassName) + local swep = getRandomMGBaseSWEP() + local w = v:Give(swep.ClassName) timer.Simple(1, function() if w:GetPrimaryAmmoType() ~= -1 then v:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end if w:GetSecondaryAmmoType() ~= -1 then v:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end end) end - else + elseif GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() and not GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then + for i = 0, 1 do + -- We don't need ammo because ARC9 got the infinite ammo option! + + local swep = getRandomARC9SWEP() + v:Give(swep.ClassName) + end + elseif not GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() and not GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then for _, b in ipairs(BEATRUN_GAMEMODES_LOADOUTS[math.random(#BEATRUN_GAMEMODES_LOADOUTS)]) do local w = v:Give(b)