Garry's Mod Wiki


Entity:CallOnRemove( string identifier, function removeFunc, vararg argn... )


Causes a specified function to be run if the entity is removed by any means. This can later be undone by Entity:RemoveCallOnRemove if you need it to not run.

Using players with this function will provide a gimped entity to the callback.


1 string identifier
Identifier of the function within CallOnRemove
2 function removeFunc
Function to be called on remove
3 vararg argn...
Optional arguments to pass to removeFunc. Do note that the first argument passed to the function will always be the entity being removed, and the arguments passed on here start after that.


Stops an engine sound when the entity is removed

Entity:CallOnRemove("StopEngineSound",function(ent) ent:StopSound( "enginenoise.wav" ) end)

Page Links

Special Pages



Render Time: 33ms

DB GetPage 3
Generate Html 6
SaveChanges (1) 10
Render Body 0
Render Sidebar 11