Garry's Mod Wiki

Revision Difference

ENTITY:OnRemove#514614

<function name="OnRemove" parent="ENTITY" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Called when the entity is about to be removed.⤶ ⤶ See also <page>Entity:CallOnRemove</page>, which can even be used on engine (non-Lua) entities.⤶ ⤶ ## Clientside behaviour remarks⤶ ⤶ ⤶ ⤶ This hook may be called at odd times (when entity has actually not yet been removed from the server). This happens during fullupdate with the <page>ENTITY:Initialize</page> function not being called even when the entity reappears.⤶ You can debug this behaviour by enabling cheats and running **cl_fullupdate** on the client.⤶ ⤶ <page>GM:NotifyShouldTransmit</page> can be used to circumvent this problem. <page>ENTITY:Think</page> can also be used to detect that the entity has reappeared. You may reinitialize any necessary data in these hooks.⤶ </description>⤶ <realm>Shared</realm>⤶ <predicted>No</predicted>⤶ </function>⤶ ⤶