Help with custom weapon pickup & Terrorist Items

So i’m trying to work with the hook PlayerCanPickupWeapon() but it doesnt work for me in TTT

I tried the simplest of codes to test but here it is:


hook.Add( "PlayerCanPickupItem", "NoPistolGiveFists", function( ply, wep )
	ply:ChatPrint("test")
end )

And another problem im having is when i add this code into my server ever since i added a bot anything to do with the game modes hud and scoreboard completely breaks:


if SERVER then

	AddCSLuaFile();

else

	local oWeaponsGetList = weapons.GetList;

	function weapons.GetList()

		local tbl = oWeaponsGetList();
		local grp = LocalPlayer():GetUserGroup();

		--Modify weapons.GetList() returned results if it's called by cl_equip.lua's GetEquipmentForRole function
		--Based on the LocalPlayer's ULX group
		if( string.find( tostring( debug.traceback() ), "GetEquipmentForRole" ) != nil ) then

			for k,v in pairs( tbl ) do

				if( v and v.CanBuy ) then

					if( v.GroupOnly and v.Groups ) then

						if( !table.HasValue( v.Groups, grp ) ) then

							table.remove( tbl, k );

						end

					end

				end

			end

		end
		
		return tbl;

	end

end


Have you checked your capitalization, because lua is CASE-sensitive

Honestly i don’t see how capitalization would mess up my code right now, when it only screws up when i added bots to the server, other than that that code worked. But yes I am familiar that it is i retyped the first one kind of fast and didn’t capitalize Ply or Wep.

You might be able to find better help in Developer Discussion.

The code below the other is meant to make it so i can do a group only swep in the Detective and Traitor menu but it just breaks everything now for some reason when ever its added.

So you’re trying to add it to the c-menu or making it spawn on the ground?

What the code does below which did work before i added a bot to my server then everything broke. It would remove the item from the Traitor/Detective menu just fine unless they were the rank. But now it gives me a ton of errors for the scoreboard, hud, and some more. And also ill ask in their kinda spaced me that there is a section on here for that.