Strip weapon by class ttt

is there any way of stripping everything in, say, a pistol class without going through and putting the name of every pistol down?

You could try creating a weapon table and specifying what they are allowed to have:

WeaponTable = {"weapon_ttt_minigun", "weapon_zm_improvised","weapon_zm_carry"}
			function PlayerCanPickupWeapon( ply, wep )
				if ply:Team() == 1 ang table.HasValue( WeaponTable, wep:GetClass() ) then 
            return false 
    return trueendhook.Add( "PlayerCanPickupWeapon", "Team1_PlayerCanPickupWeapon", PlayerCanPickupWeapon )

the goal is to clear out all pistols so I can give them a new one.

Oh sorry I misread


I’ve done something like this before. I’d recommend checking the SWEP.Slot of each if the player’s weapons and remove if necessary. Try using a “for k, v in pairs (ply:GetWeapons()) do” then check if the v.Slot is the same and remove using ply:StripWeapon(v:GetClass)

[editline]9th February 2014[/editline]

If you need to get the slot of the weapon you’re trying to give try weapons.Get(“class”).Slot

How would that look? I’m really bad at lua.

local wep = “weapon_ttt_m16” – the class of the weapon you want to give
local slot = weapons.Get( “weapon_pistol” ).Slot – get the slot of the weapon you want to give
for k, v in pairs( player.GetAll() ) do – loop through every player
players_weapons = v:GetWeapons() – get the player’s weapons
for pos, weapon in pairs( players_weapons ) do – loop through the player’s weapons
if weapon.Slot == slot then – check the slot of the weapon against the slot of the weapon you want to give
v:StripWeapon( weapon:GetClass() ) – if it’s the same, remove the weapon from the player
v:Give( wep ) – finally give the weapon to the player
Sorry about the late reply

Oh, it’s a single item for one player, I think I can figure out how to fix it though.

  • snip