> For the complete documentation index, see [llms.txt](https://wiki.redmodding.org/scripting-cyberpunk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.redmodding.org/scripting-cyberpunk/cyber-engine-tweaks/cet-functions/events/onshutdown.md).

# onShutdown

Opposing to [onInit](/scripting-cyberpunk/cyber-engine-tweaks/cet-functions/events/oninit.md), this event gets triggered whenever CET unloads all the mods, either due to the game shutting down, or when pressing the "Reload all mods" button in the [CET Overlay](https://wiki.redmodding.org/cyber-engine-tweaks/console/usage).&#x20;

Use this to do any clean-up work for your mod, e.g. despawning objects or removing status effects.

## Usage Example

{% code title="init.lua" %}

```lua
registerForEvent('onShutdown', function()

    -- cleanup code
    
end)
```

{% endcode %}
