Spawn an entity with a input variable?

I want to make an entity that a player drops when they’re dead. When another player picks it up they will receive their equipment.

I need a way to input a table or variable into a spawned entity.

Any suggestions?

[lua]function ENT:Initialize()
– This function isn’t necessary but shows how variables can be set before the entity is initialized

-- This part removes the entity if EquipmentClass hasn't been set
-- It's not necessary either but makes sure nothing weird can happen
if not self.EquipmentClass then
	print("spawned entity", self, "without an equipment class, removing")

print("spawned entity", self, "equipment class = ", self.EquipmentClass)


function ENT:Use(activator)
– When a player presses USE on us, give them whatever we’re supposed to give
– then disappear

[lua]local ent = ents.Create(“sent_whatever”)

– Set your variables here
ent.EquipmentClass = “weapon_crowbar”

– This is when Initialize gets called

Hopefully that’s self explanatory enough. By the way, just a piece of advice:

While it is ok to ask for help here, you are asking a lot of questions about fairly trivial things that you could have easily figured out by experimenting or by doing some research on the wiki. Most of the things you want to do are also used in many gamemodes and addons, so you might be interested in downloading a few interesting ones and figuring out how they work. You can extract workshop addons using this.

There’s only so much a forum can do for you, you’ll understand things a lot better if you take some effort to figure them out on your own.

You’re right, I do use the forums quite a bit, but the last few questions have legitimately boggled my head. I have investigated this method by opening the spawned_shipments entity in darkrp and I thought maybe some of you skilled coders can explain it differently than the code.

For the record the last thread I posted was a problem caused from an external script which told all entities if used return false end, which prevented me from properly executing my entities.