Entity.CallOnRemove
From GMod Wiki
Function | |
Syntax | Entity:CallOnRemove( String name, Function removeFunc, Var argument, ... ) |
Description: | |
Whenever the entity is removed by any means, this function will be called. | |
Returns: | nil |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.CallOnRemove]Entity.CallOnRemove [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Additional Notes
- Name is a unique label to stop the same function from being added several times.
- removeFunc needs to be the name of a function. This function will be run with the given arguments whenever the entity is removed.
- The arguments of removeFunc will be the entity, then the supplied arguments. For example, if you wrote Entity:CallOnRemove("x",Msg,"Hello\n"), then whenever the entity is removed it would do Msg(Entity,"Hello\n")
- This function can take any number of arguments.
- Returning false in this function doesn't do anything.