mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-29 05:13:02 +05:00
Random MW Base loadouts + started version counting lol
This commit is contained in:
parent
e1307b7904
commit
97053df95e
7 changed files with 80 additions and 24 deletions
|
@ -239,3 +239,6 @@ beatrun.infection.infectedby=has infected
|
|||
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.end=The game has ended!\nSurvivors: %s\nRestarting in 15s
|
||||
|
||||
# Server ConVars
|
||||
beatrun.randomloadouts.helptext=Toggles random MW Base loadouts in Deathmatch and DataTheft
|
||||
|
|
|
@ -239,3 +239,6 @@ beatrun.infection.infectedby=заразил
|
|||
beatrun.infection.award=Вы получили 200 XP за выживание!
|
||||
beatrun.infection.awardinfected=Вы получили 100 XP за спавн заражённым!
|
||||
beatrun.infection.end=Игра окончена!\nВыжившие: %s\nПерезапуск через 15 сек
|
||||
|
||||
# Server ConVars
|
||||
beatrun.randomloadouts.helptext=Переключает случайные наборы оружия MW Base в Deathmatch и DataTheft
|
||||
|
|
|
@ -122,14 +122,26 @@ end
|
|||
|
||||
function PLAYER:Loadout()
|
||||
if GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") then
|
||||
for _, v in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do
|
||||
local wep = self.Player:Give(v)
|
||||
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 wep:GetPrimaryAmmoType() ~= -1 then self.Player:GiveAmmo(10000, wep:GetPrimaryAmmoType(), true) end
|
||||
if wep:GetSecondaryAmmoType() ~= -1 then self.Player:GiveAmmo(5, wep:GetSecondaryAmmoType(), true) end
|
||||
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
|
||||
self.Player:RemoveAllAmmo()
|
||||
end
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
local vmatrixmeta = FindMetaTable("VMatrix")
|
||||
local playermeta = FindMetaTable("Player")
|
||||
|
||||
CLoadout = {}
|
||||
BEATRUN_GAMEMODES_LOADOUTS = {
|
||||
{"weapon_357", "weapon_ar2"}
|
||||
}
|
||||
|
||||
local mtmp = {
|
||||
{0, 0, 0, 0},
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
DATATHEFT_LOADOUTS = {
|
||||
{"weapon_357", "weapon_ar2"}
|
||||
}
|
||||
|
||||
if SERVER then
|
||||
util.AddNetworkString("DataTheft_Start")
|
||||
util.AddNetworkString("DataTheft_Sync")
|
||||
|
@ -13,18 +9,29 @@ if SERVER then
|
|||
net.Broadcast()
|
||||
|
||||
for _, v in ipairs(player.GetAll()) do
|
||||
v:DataTheft_Bank()
|
||||
|
||||
v:SetNW2Int("DataCubes", 0)
|
||||
v:SetNW2Int("DataBanked", 0)
|
||||
|
||||
if v:GetMoveType() == MOVETYPE_NOCLIP then
|
||||
v:SetMoveType(MOVETYPE_WALK)
|
||||
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 l, b in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do
|
||||
local wep = v:Give(b)
|
||||
v:GiveAmmo(9999, wep:GetPrimaryAmmoType())
|
||||
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
|
||||
|
|
|
@ -2,6 +2,20 @@ if SERVER then
|
|||
util.AddNetworkString("Deathmatch_Start")
|
||||
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()
|
||||
SetGlobalBool("GM_DEATHMATCH", true)
|
||||
|
||||
|
@ -12,11 +26,26 @@ if SERVER then
|
|||
if v:GetMoveType() == MOVETYPE_NOCLIP then
|
||||
v:SetMoveType(MOVETYPE_WALK)
|
||||
v:Spawn()
|
||||
else
|
||||
for _, b in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do
|
||||
local wep = v:Give(b)
|
||||
end
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
VERSIONGLOBAL = "v1.0?"
|
||||
VERSIONGLOBAL = "v1.0.1"
|
||||
|
||||
DeriveGamemode("sandbox")
|
||||
|
||||
|
|
Loading…
Reference in a new issue