Picking up ents with E.

What would I replace/add to make entity’s not auto pick up, so they can be picked up with the use button.


i dont think that’s what he asked for.

Yeah, he’s talking about ammo and weapons. A long while ago I wrote a script for someone that did exactly this.

Ah, right. I saw he said “Picked up with the use button”, Which reminded me of that above link. And yes, there did use to be a code on garrysmod.org for this… Cant find it now though.

If you want to do this in “Hacky” way, you could return false in hook that allows/disallows picking up items, and then hooking up to pressing “Use” key and making a trace, which when hitpos is at near distance, and entity is weapon, give it to player and remove the “original”.

In “non hacky” way you can just make a new entity which on use will give the gun you’ve set it, then alter all situations when gun is dropped, to creating this entity and removing original “droppable” weapon.

Couldnt you do something with the PlayerCanPickupWeapon hook?