So I saw there is some TTT hack that goes through every entity to check if it is the same as black listed weapons. There is a way better method. This method isn't as optimized as my private method, but it should work just as well. As you can tell, this is extremely basic. This is so you can experiment with it. My method is very different from this, but could also be detected if I gave it out. There are many different ways to detecting traitors and this is just one. This should work on every server. I don't do checks if the player is detective or if the weapon has been found before. That is for you to do.
Code:
for _, ent in pairs( ents.GetAll() ) do
if ( ent:IsWeapon() and ent.CanBuy and IsValid( ent:GetOwner() ) and ent:GetOwner():IsPlayer() ) then
local owner = ent:GetOwner();
print( owner:Nick().." is a traitor!" );
end
end