> For the complete documentation index, see [llms.txt](https://docs.av-scripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.av-scripts.com/laptop-pack-v3/groups/events.md).

# Events

{% hint style="info" %}
The following events are triggered after specific exports are triggered, here's a list of all events and the exports that triggers it.
{% endhint %}

## What's `resource:`?

* **`resource`** is the name of the resource to which the group belongs. In other words, if your resource is called **"av\_boosting"**, then the event name will be **"av\_boosting:groupDeleted"**, for example.

## resource:groupDeleted

> This **client event** is triggered when the export **deleteGroup()** wipes a group, it is triggered to every member of the group, the event doesn't contain any parameter.
>
> {% code title="resource/client.lua" %}
>
> ```lua
> RegisterNetEvent("av_boosting:groupDeleted", function()
>     print("oops your group got deleted")
> end
> ```
>
> {% endcode %}

## resource:updateGroup

> This is a client event and is triggered only to the members from a group when a member gets removed. It contains all group info.
>
> ```lua
> RegisterNetEvent('av_boosting:updateGroup', function(group)
>     print(json.encode(group, {indent = true}))
> end
> ```

## resource:updateGroups

> This **client event** is triggered only if one of the following exports are successful:
>
> * **createGroups():** If the group is created, the script will update all players in server.
> * **removeMember():** If a member is removed from a group, this will update the removed player and all members from the same group.
> * **leaveGroup():** If a member leaves a group it will update the group members only, BUT if the group doesn't have any members left it will update all players in server.
>
> {% code title="resource/client.lua" %}
>
> ```lua
> -- The event receives all existing groups that belong to that resource
> RegisterNetEvent("av_boosting:updateGroups", function(allGroups)
>     print(json.encode(allGroups, {indent = true}))
> end
> ```
>
> {% endcode %}

## resource:leaveGroup

> This is a **client and server event** and it gets triggered after one of the following exports are successful:
>
> * **removeMember()**: If member is removed from a group.
> * **leaveGroup()**: If a member leaves a group.
> * **deleteGroup():** When a group is deleted.
>
> {% code title="resource/server.lua" %}
>
> ```lua
> RegisterServerEvent("av_boosting:leaveGroup", function(identifier)
>     local playerSource = exports['av_laptop']:getSourceByIdentifier(identifier)
>     if playerSource then
>         -- Trigger something to client if you want (or not)
>     end
> end)
> ```
>
> {% endcode %}
>
> {% code title="resource/client.lua" %}
>
> ```lua
> RegisterNetEvent('av_boosting:leaveGroup', function()
>     print("Player got removed from a group :(")
> end)
> ```
>
> {% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.av-scripts.com/laptop-pack-v3/groups/events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
