mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-27 04:23:02 +05:00
testing random arc9 weapons
This commit is contained in:
parent
148352596f
commit
d7d9a16250
3 changed files with 50 additions and 23 deletions
|
@ -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
|
||||
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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue