mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-27 20:43:02 +05:00
proper arc9 random weapons
This commit is contained in:
parent
d7d9a16250
commit
45c2c77bc3
6 changed files with 42 additions and 80 deletions
|
@ -124,26 +124,7 @@ end
|
|||
|
||||
function PLAYER:Loadout()
|
||||
if GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") then
|
||||
if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then
|
||||
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
|
||||
Beatrun_GiveGMWeapon(self.Player)
|
||||
else
|
||||
self.Player:RemoveAllAmmo()
|
||||
end
|
||||
|
|
|
@ -91,7 +91,12 @@ function playermeta:notUsingRH(wep)
|
|||
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 wepIndex = math.random(#allWep)
|
||||
local wep = allWep[wepIndex]
|
||||
|
@ -99,11 +104,11 @@ function getRandomMGBaseSWEP()
|
|||
if wep.Base == "mg_base" and not wep.AdminOnly then
|
||||
return wep
|
||||
else
|
||||
return getRandomMGBaseSWEP()
|
||||
return Beatrun_getRandomMWBaseSWEP()
|
||||
end
|
||||
end
|
||||
|
||||
function getRandomARC9SWEP()
|
||||
function Beatrun_getRandomARC9SWEP()
|
||||
local allWep = weapons.GetList()
|
||||
local wepIndex = math.random(#allWep)
|
||||
local wep = allWep[wepIndex]
|
||||
|
@ -111,6 +116,34 @@ function getRandomARC9SWEP()
|
|||
if wep.Base == "arc9_cod2019_base" and not wep.AdminOnly then
|
||||
return wep
|
||||
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
|
||||
|
|
|
@ -22,33 +22,7 @@ if SERVER then
|
|||
v:Spawn()
|
||||
end
|
||||
|
||||
if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() and not GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() then
|
||||
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
|
||||
Beatrun_GiveGMWeapon(v)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,33 +17,7 @@ if SERVER then
|
|||
v:Spawn()
|
||||
end
|
||||
|
||||
if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() and not GetConVar("Beatrun_RandomARC9Loadouts"):GetBool() then
|
||||
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
|
||||
Beatrun_GiveGMWeapon(v)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
VERSION_GLOBAL = "1.0.18"
|
||||
VERSION_GLOBAL = "1.0.20"
|
||||
VERSION_LATEST = ""
|
||||
VERSION_CHECKED = false
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.0.18
|
||||
1.0.20
|
Loading…
Reference in a new issue