GM.Name = "Feedc0de's coop Mode" GM.Author = "0xFEEDC0DE64" GM.Email = "daniel@brunner.ninja" GM.Website = "brunner.ninja" DeriveGamemode("sandbox") include( "levels.lua" ) include( "progression_shared.lua" ) if (SERVER) then function ChangeRandomLevel() local randomLevel = GetRandomLevel() if not randomLevel then ErrorNoHalt("[custom_coop] No other installed coop map was found in levels.lua\n") return false end print("[custom_coop] Changing to random level " .. randomLevel) RunConsoleCommand("changelevel", randomLevel) return true end function NextRandomLevel() local randomLevel = GetRandomLevel() if not randomLevel then ErrorNoHalt("[custom_coop] Cannot set nextlevel: no other installed coop map was found\n") return nil end print("[custom_coop] Setting nextlevel to " .. randomLevel) RunConsoleCommand("nextlevel", randomLevel) return randomLevel end concommand.Add("randomlevel", ChangeRandomLevel) concommand.Add("randomnextlevel", NextRandomLevel) hook.Add("Initialize", "SetupRandomLevels", function() timer.Simple(0, NextRandomLevel) end) end -- timer.Simple( -- 1, -- function() -- function HideThings(name) -- if (name == "CHudDamageIndicator" or name == "CHudHintDisplay") then -- return false -- end -- end -- hook.Add("HUDShouldDraw", "HideThings", HideThings) -- end -- ) function GM:IsSpawnpointSuitable(ply, spawnpointent, bMakeSuitable) local Pos = spawnpointent:GetPos() -- Note that we're searching the default hull size here for a player in the way of our spawning. -- This seems pretty rough, seeing as our player's hull could be different.. but it should do the job -- ( HL2DM kills everything within a 128 unit radius ) local Ents = ents.FindInBox(Pos + Vector(-16, -16, 0), Pos + Vector(16, 16, 72)) if (ply:Team() == TEAM_SPECTATOR or ply:Team() == TEAM_UNASSIGNED) then return true end local Blockers = 0 for k, v in pairs(Ents) do if (IsValid(v) and v:GetClass() == "player" and v:Alive()) then Blockers = Blockers + 1 if (bMakeSuitable) then v:SetVelocity(v:GetPos() + Vector(100, 100, 0)) end end end if (bMakeSuitable) then return true end if (Blockers > 0) then return false end return true end function GM:PlayerLoadout(ply) if (not striponspawn) then ply:Give("weapon_fists") end end hook.Add( "SpawnMenuOpen", "DisallowSpawnMenu", function () return LocalPlayer():IsAdmin() end) hook.Add( "ContextMenuOpen", "DisallowSpawnMenu", function () return LocalPlayer():IsAdmin() end) function GM:PlayerNoClip(ply, desiredState) if desiredState then return ply:IsAdmin() else return true end end function GM:PlayerDeathSound() return true end function GM:DrawDeathNotice(x, y) return false end function GM:PlayerSpawnVehicle(ply, model, name, table) return ply:IsAdmin() end function GM:PlayerSpawnSWEP(ply, weapon, info) return ply:IsAdmin() end function GM:PlayerSpawnSENT(ply, class) return ply:IsAdmin() end function GM:PlayerSpawnRagdoll(ply, model) return ply:IsAdmin() end function GM:PlayerSpawnProp(ply, model) return ply:IsAdmin() end function GM:PlayerSpawnObject(ply, model, skin) return ply:IsAdmin() end function GM:PlayerSpawnNPC(ply, npc_type, weapon) return ply:IsAdmin() end function GM:PlayerSpawnEffect(ply, model) return ply:IsAdmin() end function GM:PlayerGiveSWEP(ply, weapon, swep) return ply:IsAdmin() end --function GM:HUDAmmoPickedUp( item, amount ) -- return false; --end