Compare commits

..

2 commits

Author SHA1 Message Date
45c2c77bc3
proper arc9 random weapons 2024-11-08 21:57:50 +05:00
d7d9a16250
testing random arc9 weapons 2024-11-08 21:35:11 +05:00
6 changed files with 66 additions and 77 deletions

View file

@ -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

View file

@ -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,61 @@ function playermeta:notUsingRH(wep)
else
return false
end
end
end
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]
if wep.Base == "mg_base" and not wep.AdminOnly then
return wep
else
return Beatrun_getRandomMWBaseSWEP()
end
end
function Beatrun_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 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

View file

@ -22,26 +22,7 @@ if SERVER then
v:Spawn()
end
if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then
for i = 0, 1 do
local randomSWEP = getRandomMGBaseWeapon()
local w = v:Give(randomSWEP.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
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

View file

@ -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,26 +17,7 @@ if SERVER then
v:Spawn()
end
if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then
for i = 0, 1 do
local randomSWEP = getRandomMGBaseWeapon()
local w = v:Give(randomSWEP.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
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

View file

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

View file

@ -1 +1 @@
1.0.18
1.0.20