Unlimited Supply of Crowbars

Hello,

I have created a smash gamemode on the workshop, pretty simple, but i want to make an entity or something to create unlimited amount of crowbars, so when its chicken fight, everyone gets a crowbar, but i do not have a single clue on how to even start on creating an entity, is it simple?

I don’t have a clue. :L

Thanks, -sam

  1. Create a folder, name it something alike: gm_entity_name (without spaces, replace GM with short of your gamemode)
  2. Create 3 files inside: shared, cl_init, init.
  3. Put info inside shared:
    [lua]ENT.Name
    ENT.Author
    ENT.Category
    ENT.Spawnable
    ENT.AdminSpawnable[/lua]

And now, basically, all you have to do is the hooks to define entities functionality: http://wiki.garrysmod.com/page/Category:ENTITY_Hooks

Ofcourse, you have to remember to put shared hooks into shared.lua, serverside into init.lua etc.
Your functions also have (actually don’t have to, because you can use hook.Add, but it’s better to do it this way)
[lua]function ENT:HookName( arg, arg2 )
–code
end[/lua]

Cool thing is that you can call the entity using “self”, like: self:SetHealth( 500 )

Another thing you can do is make sure all players spawn with a crowbar, and can not drop them; you can do this permanently or just for your chicken-fight-event.