Random MW Base loadouts + started version counting lol

This commit is contained in:
Jonny_Bro (Nikita) 2024-05-28 21:07:59 +05:00
parent e1307b7904
commit 97053df95e
No known key found for this signature in database
GPG key ID: 3F1ECC04147E9BD8
7 changed files with 80 additions and 24 deletions

View file

@ -239,3 +239,6 @@ beatrun.infection.infectedby=has infected
beatrun.infection.award=You were awarded 200 XP for surviving! beatrun.infection.award=You were awarded 200 XP for surviving!
beatrun.infection.awardinfected=You were awarded 100 XP for spawning as an infected! beatrun.infection.awardinfected=You were awarded 100 XP for spawning as an infected!
beatrun.infection.end=The game has ended!\nSurvivors: %s\nRestarting in 15s beatrun.infection.end=The game has ended!\nSurvivors: %s\nRestarting in 15s
# Server ConVars
beatrun.randomloadouts.helptext=Toggles random MW Base loadouts in Deathmatch and DataTheft

View file

@ -239,3 +239,6 @@ beatrun.infection.infectedby=заразил
beatrun.infection.award=Вы получили 200 XP за выживание! beatrun.infection.award=Вы получили 200 XP за выживание!
beatrun.infection.awardinfected=Вы получили 100 XP за спавн заражённым! beatrun.infection.awardinfected=Вы получили 100 XP за спавн заражённым!
beatrun.infection.end=Игра окончена!\nВыжившие: %s\nПерезапуск через 15 сек beatrun.infection.end=Игра окончена!\nВыжившие: %s\nПерезапуск через 15 сек
# Server ConVars
beatrun.randomloadouts.helptext=Переключает случайные наборы оружия MW Base в Deathmatch и DataTheft

View file

@ -122,13 +122,25 @@ 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
for _, v in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then
local wep = self.Player:Give(v) for i = 0, 1 do
local randomSWEP = getRandomMGBaseWeapon()
local w = self.Player:Give(randomSWEP.ClassName)
timer.Simple(1, function() timer.Simple(1, function()
if wep:GetPrimaryAmmoType() ~= -1 then self.Player:GiveAmmo(10000, wep:GetPrimaryAmmoType(), true) end if w:GetPrimaryAmmoType() ~= -1 then self.Player:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end
if wep:GetSecondaryAmmoType() ~= -1 then self.Player:GiveAmmo(5, wep:GetSecondaryAmmoType(), true) end if w:GetSecondaryAmmoType() ~= -1 then self.Player:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end
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 end
else else
self.Player:RemoveAllAmmo() self.Player:RemoveAllAmmo()

View file

@ -1,7 +1,9 @@
local vmatrixmeta = FindMetaTable("VMatrix") local vmatrixmeta = FindMetaTable("VMatrix")
local playermeta = FindMetaTable("Player") local playermeta = FindMetaTable("Player")
CLoadout = {} BEATRUN_GAMEMODES_LOADOUTS = {
{"weapon_357", "weapon_ar2"}
}
local mtmp = { local mtmp = {
{0, 0, 0, 0}, {0, 0, 0, 0},

View file

@ -1,7 +1,3 @@
DATATHEFT_LOADOUTS = {
{"weapon_357", "weapon_ar2"}
}
if SERVER then if SERVER then
util.AddNetworkString("DataTheft_Start") util.AddNetworkString("DataTheft_Start")
util.AddNetworkString("DataTheft_Sync") util.AddNetworkString("DataTheft_Sync")
@ -13,18 +9,29 @@ if SERVER then
net.Broadcast() net.Broadcast()
for _, v in ipairs(player.GetAll()) do for _, v in ipairs(player.GetAll()) do
v:DataTheft_Bank()
v:SetNW2Int("DataCubes", 0)
v:SetNW2Int("DataBanked", 0)
if v:GetMoveType() == MOVETYPE_NOCLIP then if v:GetMoveType() == MOVETYPE_NOCLIP then
v:SetMoveType(MOVETYPE_WALK) v:SetMoveType(MOVETYPE_WALK)
v:Spawn() 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 else
for l, b in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do for _, b in ipairs(BEATRUN_GAMEMODES_LOADOUTS[math.random(#BEATRUN_GAMEMODES_LOADOUTS)]) do
local wep = v:Give(b) local w = v:Give(b)
v:GiveAmmo(9999, wep:GetPrimaryAmmoType())
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

@ -2,6 +2,20 @@ if SERVER then
util.AddNetworkString("Deathmatch_Start") util.AddNetworkString("Deathmatch_Start")
util.AddNetworkString("Deathmatch_Sync") util.AddNetworkString("Deathmatch_Sync")
CreateConVar("Beatrun_RandomMWLoadouts", 0, {FCVAR_REPLICATED, FCVAR_ARCHIVE}, "#beatrun.randomloadouts.helptext")
function getRandomMGBaseWeapon()
local allWep = weapons.GetList()
local wepIndex = math.random(#allWep)
local wep = allWep[wepIndex]
if wep.Base == "mg_base" then
return wep
else
return getRandomMGBaseWeapon()
end
end
function Beatrun_StartDeathmatch() function Beatrun_StartDeathmatch()
SetGlobalBool("GM_DEATHMATCH", true) SetGlobalBool("GM_DEATHMATCH", true)
@ -12,11 +26,26 @@ if SERVER then
if v:GetMoveType() == MOVETYPE_NOCLIP then if v:GetMoveType() == MOVETYPE_NOCLIP then
v:SetMoveType(MOVETYPE_WALK) v:SetMoveType(MOVETYPE_WALK)
v:Spawn() v:Spawn()
else end
for _, b in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do
local wep = v:Give(b)
v:GiveAmmo(9999, wep:GetPrimaryAmmoType() or "Pistol", true) 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
end end
end end

View file

@ -1,4 +1,4 @@
VERSIONGLOBAL = "v1.0?" VERSIONGLOBAL = "v1.0.1"
DeriveGamemode("sandbox") DeriveGamemode("sandbox")