proper arc9 random weapons

This commit is contained in:
Jonny_Bro (Nikita) 2024-11-08 21:57:50 +05:00
parent d7d9a16250
commit 45c2c77bc3
No known key found for this signature in database
GPG key ID: 3F1ECC04147E9BD8
6 changed files with 42 additions and 80 deletions

View file

@ -124,26 +124,7 @@ end
function PLAYER:Loadout() function PLAYER:Loadout()
if GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") then if GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") then
if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then Beatrun_GiveGMWeapon(self.Player)
for i = 0, 1 do
local randomSWEP = getRandomMGBaseWeapon()
local w = self.Player:Give(randomSWEP.ClassName)
timer.Simple(1, function()
if w:GetPrimaryAmmoType() ~= -1 then self.Player:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end
if w:GetSecondaryAmmoType() ~= -1 then self.Player:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end
end)
end
else
for _, v in ipairs(BEATRUN_GAMEMODES_LOADOUTS[math.random(#BEATRUN_GAMEMODES_LOADOUTS)]) do
local w = self.Player:Give(v)
timer.Simple(1, function()
if w:GetPrimaryAmmoType() ~= -1 then self.Player:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end
if w:GetSecondaryAmmoType() ~= -1 then self.Player:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end
end)
end
end
else else
self.Player:RemoveAllAmmo() self.Player:RemoveAllAmmo()
end end

View file

@ -91,7 +91,12 @@ function playermeta:notUsingRH(wep)
end end
end end
function getRandomMGBaseSWEP() function Beatrun_GiveAmmo(weapon, ply)
if weapon:GetPrimaryAmmoType() ~= -1 then ply:GiveAmmo(10000, weapon:GetPrimaryAmmoType(), true) end
if weapon:GetSecondaryAmmoType() ~= -1 then ply:GiveAmmo(5, weapon:GetSecondaryAmmoType(), true) end
end
function Beatrun_getRandomMWBaseSWEP()
local allWep = weapons.GetList() local allWep = weapons.GetList()
local wepIndex = math.random(#allWep) local wepIndex = math.random(#allWep)
local wep = allWep[wepIndex] local wep = allWep[wepIndex]
@ -99,11 +104,11 @@ function getRandomMGBaseSWEP()
if wep.Base == "mg_base" and not wep.AdminOnly then if wep.Base == "mg_base" and not wep.AdminOnly then
return wep return wep
else else
return getRandomMGBaseSWEP() return Beatrun_getRandomMWBaseSWEP()
end end
end end
function getRandomARC9SWEP() function Beatrun_getRandomARC9SWEP()
local allWep = weapons.GetList() local allWep = weapons.GetList()
local wepIndex = math.random(#allWep) local wepIndex = math.random(#allWep)
local wep = allWep[wepIndex] local wep = allWep[wepIndex]
@ -111,6 +116,34 @@ function getRandomARC9SWEP()
if wep.Base == "arc9_cod2019_base" and not wep.AdminOnly then if wep.Base == "arc9_cod2019_base" and not wep.AdminOnly then
return wep return wep
else else
return getRandomARC9SWEP() return Beatrun_getRandomARC9SWEP()
end
end
function Beatrun_GiveGMWeapon(ply)
if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() and not GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() then
for i = 0, 1 do
local swep = Beatrun_getRandomMWBaseSWEP()
local w = ply:Give(swep.ClassName)
timer.Simple(1, function()
Beatrun_GiveAmmo(w, ply)
end)
end
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 = Beatrun_getRandomARC9SWEP()
ply: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)
timer.Simple(1, function()
Beatrun_GiveAmmo(w, ply)
end)
end
end end
end end

View file

@ -22,33 +22,7 @@ if SERVER then
v:Spawn() v:Spawn()
end end
if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() and not GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() then Beatrun_GiveGMWeapon(v)
for i = 0, 1 do
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
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)
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
end
end end
end end

View file

@ -17,33 +17,7 @@ if SERVER then
v:Spawn() v:Spawn()
end end
if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() and not GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() then Beatrun_GiveGMWeapon(v)
for i = 0, 1 do
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
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)
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
end
end end
end end

View file

@ -1,4 +1,4 @@
VERSION_GLOBAL = "1.0.18" VERSION_GLOBAL = "1.0.20"
VERSION_LATEST = "" VERSION_LATEST = ""
VERSION_CHECKED = false VERSION_CHECKED = false

View file

@ -1 +1 @@
1.0.18 1.0.20