From 3e23a89326945a13612b3c400181d2ad5f60a95a Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 15 Dec 2014 18:55:23 +0000 Subject: [PATCH] Added logic_stripweapons entity Specific entity to remove a weapon that targets a player activator holds: --keys-- keepfists: If yes, the stripallweapons input strips all weapons but fists --Inputs-- stripweapon: Strips a single weapon as mentioned in arguments stripallweapons: Strips all weapons the activator has setkeepfists: If 1 the stripallweapons inputs strip all weapons but fists --- .../entities/logic_stripweapons/init.lua | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 gamemodes/zombiesurvival/entities/entities/logic_stripweapons/init.lua diff --git a/gamemodes/zombiesurvival/entities/entities/logic_stripweapons/init.lua b/gamemodes/zombiesurvival/entities/entities/logic_stripweapons/init.lua new file mode 100644 index 0000000..c92c4c1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/logic_stripweapons/init.lua @@ -0,0 +1,36 @@ +ENT.Type = "point" + +function ENT:Initialize() + self.KeepFists = self.KeepFists or 1 +end + +function ENT:AcceptInput(name, activator, caller, args) + name = string.lower(name) + if name == "stripweapon" then + if activator:IsPlayer() and activator:Alive() and activator:Team() == TEAM_HUMAN then + activator:StripWeapon(args) + end + elseif name == "stripallweapons" then + if activator:IsPlayer() and activator:Alive() and activator:Team() == TEAM_HUMAN then + if tonumber(self.KeepFists) == 1 then + local weps = activator:GetWeapons() + for k, v in pairs(weps) do + local weaponclass = v:GetClass() + if weaponclass ~= "weapon_zs_fists" then activator:StripWeapon(weaponclass) end + end + else + activator:StripWeapons(args) + end + end + elseif name == "setkeepfists" then + self.KeepFists = tonumber(args) + end +end + +function ENT:KeyValue(key, value) + key = string.lower(key) + if key == "keepfists" then + self.KeepFists = tonumber(value) + end +end + \ No newline at end of file