From b83b5c56d57bed6986bcc620399de8cf29bc56f2 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 16 Nov 2014 02:42:34 +0000 Subject: [PATCH] Added support for hammer made weapons in ZE - Restricted each player to using only one of these special weapons per round. --- .../zombiesurvival/gamemode/sh_globals.lua | 6 ++++++ .../gamemode/sh_zombieescape.lua | 20 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/sh_globals.lua b/gamemodes/zombiesurvival/gamemode/sh_globals.lua index f639d99..79ebbff 100644 --- a/gamemodes/zombiesurvival/gamemode/sh_globals.lua +++ b/gamemodes/zombiesurvival/gamemode/sh_globals.lua @@ -92,6 +92,12 @@ ZE_KNOCKBACKSCALE = 0.1 MASK_HOVER = bit.bor(CONTENTS_OPAQUE, CONTENTS_GRATE, CONTENTS_HITBOX, CONTENTS_DEBRIS, CONTENTS_SOLID, CONTENTS_WATER, CONTENTS_SLIME, CONTENTS_WINDOW, CONTENTS_LADDER, CONTENTS_PLAYERCLIP, CONTENTS_MOVEABLE, CONTENTS_DETAIL, CONTENTS_TRANSLUCENT) +CSSWEAPONS = {"weapon_knife","weapon_glock","weapon_usp","weapon_p228","weapon_deagle", + "weapon_elite","weapon_fiveseven","weapon_m3","weapon_xm1014","weapon_galil", + "weapon_ak47","weapon_scout","weapon_sg552","weapon_awp","weapon_g3sg1", + "weapon_famas","weapon_m4a1","weapon_aug","weapon_sg550","weapon_mac10", + "weapon_tmp","weapon_mp5navy","weapon_ump45","weapon_p90","weapon_m249"} + GM.BarricadeHealthMin = 50 GM.BarricadeHealthMax = 1100 GM.BarricadeHealthMassFactor = 3 diff --git a/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua b/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua index 1f1569e..0354c16 100644 --- a/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua +++ b/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua @@ -76,10 +76,24 @@ end end hook.Add("Initialize", "RegisterDummyEntities", function() - scripted_ents.Register(ENT, "weapon_elite") - scripted_ents.Register(ENT, "weapon_knife") - scripted_ents.Register(ENT, "weapon_deagle") scripted_ents.Register(ENT, "ammo_50ae") scripted_ents.Register(ENT, "ammo_556mm_box") scripted_ents.Register(ENT, "player_weaponstrip") + + --CSS Weapons for ZE map parenting + for i, weapon in pairs(CSSWEAPONS) do + weapons.Register({Base = "weapon_map_base"},weapon) + end +end) + +hook.Add( "PlayerCanPickupWeapon", "RestrictMapWeapons", function( ply, wep ) + + local weps = ply:GetWeapons() + + --Only allow one special weapon per player + for k, v in pairs(weps) do + if table.HasValue( CSSWEAPONS, v:GetClass() ) or v:GetClass()=="weapon_map_base" then return false end + end + + return true end)