# Events

> This events can be triggered from your own resource to interact with the Laptop script.

### av\_laptop:close

> This event is client side and works for closing the laptop UI.
>
> ```lua
> -- client side:
> TriggerEvent('av_laptop:close')
> -- server side:
> TriggerClientEvent('av_laptop:close', playerId)
> ```

### av\_laptop:closed

> This client event is triggered when laptop is closed, use it in your own scripts as listener:
>
> ```lua
> AddEventHandler('av_laptop:closed', function()
>     -- laptop is closed do something
> end
> ```

### Wifi Event

> * The following event gets triggered when the player connects/disconnects from a hotspot, you can use it in your own resource:
>
> ```lua
> RegisterNetEvent('av_laptop:WiFi', function(hotspot)
>     print(hotspot)
>     -- hotspot: string | null if disconnected
> end)
> ```

### av\_laptop:closeApp

> * Close an specific app by sending the app name as argument, this event is client side.
>
> ```lua
> -- client side:
> TriggerEvent('av_laptop:closeApp', "business")
> -- server side:
> TriggerClientEvent('av_laptop:closeApp', playerId, "business")
> ```

> Use this event to trigger a notification to the user, if the user is using the laptop it will use the UI notification component, otherwise it will use the regular ox\_lib notification.
>
> **params:**
>
> * **title**:`string` Notification header
> * **message**:`string` The message to display
> * **type**:`string` Type can be "error", "success" or "inform"
>
> ```lua
> -- client side
> TriggerEvent('av_laptop:notificationUI', "AV Scripts", "Hello world!", "success"
> -- server side
> TriggerClientEvent('av_laptop:notificationUI', playerId, "AV Scripts", "Hello World!", "success"
> ```

### av\_laptop:tablet

> Toggle the tablet animation, it doesn't do anything else just an animation.
>
> **params:**
>
> * **state**:`boolean` Toggle the tablet animation
>
> ```lua
> -- client side
> TriggerEvent('av_laptop:tablet', true) -- or false to stop animation
> -- server side
> TriggerClientEvent('av_laptop:tablet', playerId, true) -- or false to stop animation
> ```

#### av\_laptop:appClosed

> This is an Event Listener, should be added to your own resource and will be triggered every time player closes an App.

{% code title="" %}

```lua
AddEventHandler("av_laptop:appClosed", function(appName)
    print(appName)
    if appName == "boosting" then -- replace boosting with any APP you want
        -- do something
    end
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://docs.av-scripts.com/laptop-pack-v3/laptop-v3/events.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.
