ENT.SpawnFunction
From GMod Wiki
Event Hook | |
Hook Name | SpawnFunction |
Syntax | ENT:SpawnFunction( Player Player, Structure Trace ) |
Description | Called when a player presses the button in the spawn menu to spawn this SENT in the Sandbox gamemode. In here you should create your entity using ents.Create() and spawn it inside the world. |
Returns | Nil |
Lua State | |
BBCode | [b][url=wiki.garrysmod.com/?title=ENT.SpawnFunction]ENT.SpawnFunction [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Additional Notes
- This function is only called in the Sandbox gamemode and is only called on SENTs.
- If you do not put this function in your SENT you will not be able to spawn it from the spawn menu.
- You must return the entity you spawned from inside the function.
- If you wish to manually call this function outside of the spawnmenu, use this:
local ent = scripted_ents.GetStored(EntName) ent.t:SpawnFunction(ply, tr)
That will spawn the requested entity, running the SpawnFunction function.