How to No-collide M9K Weapons by Default

Hey guys! So the Garry’s Mod community i’m staff on just opened a forth server and they made me the main developer. It is a JailBreak server and on some maps the location where the guns spawn in the armory makes them collide with each other and freak out. This causes a lot of lag and no-colliding the M9K weapons would fix the problem. I have been looking on the internet and looking through the M9K Lua files and I can not figure out how to get the guns to no-collide. If anyone knows how to do it or knows another way I can fix it, please help me out. Anyways, have a great day!

Make a for loop with entity.find, and then make an table with all the guns in the armory, since you are a main dev, it shouldnt be that hard.

No need for a for loop, just set the collision group after spawning them or if you don’t want to modify any thirdparty code use at least OnEntityCreated hook instead and check for the class in there, just try to avoid any long loops per frame.

OnEntityCreated is literally the same as a loop, since he’d need to use a table, and check for all the entities of the given weapons…

Agreeing with this, without a loop he would have to name each m9k class one by one, no need to do it that way. Just use a table of weapons, I’m not sure if M9K weapons all have the same category in their swep but if they do you could just check to see if their category == “M9K Weps” [[or whatever the category is]] and if true, change the collision group - that is how a server I work checks if a weapon is FAS2.

I simply would get all the weapon classes in the armory(I doubt there are ALL M9K sweps), and loop through them, done.

Yeah that actually sounds easier, so you could just loop through all the weapons on the map and change their collision group

Alright, so this is what I got but it still seems to not be working.

[lua]for k,v in pairs(ents.FindByClass(“m9k_*”)) do

  1. When is that code executed/which hook is used?
  2. Did you make sure the code is actually executed?
  3. Is it executed on the correct side as in server/client instance.
  4. Are those weapons dynamically spawned? if so use OnEntityCreated as already suggested.

Yeah sure…

local entclass = “mk9_whateverfollows” – ent:GetClass()
print(entclass:sub(1, 4) == “mk9_”)
> true

Read closely, he doesnt want to nocolide ALL M9K weapons, only the ones in the ARMORY, jesus.

That does not change anything on the given 4 points the second part is just a snippet so come down from your big horse and stop changing facts you are not really helping at all.