# onShutdown

Opposing to [onInit](/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](/cyber-engine-tweaks/console/usage.md).&#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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.redmodding.org/cyber-engine-tweaks/cet-functions/events/onshutdown.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
