# Events Exports

## 📋 Events & Exports

### Open Market from Another Script

\-- Client-side: Open a specific store exports\['elenashop']:OpenMarket('247\_1')

***

### Server Events

\-- Purchase event (triggered by client) RegisterNetEvent('elenashop:server:purchase', function(storeId, items, method) -- Handled internally end)

***

### Client Events

\-- Purchase result (sent by server) RegisterNetEvent('elenashop:client:purchaseResult', function(success, message, newCash, newBank, updatedStock) -- Handled internally, updates UI end)

***

### NUI Messages

\-- Open market UI SendNUIMessage({ action = 'openMarket', storeName = 'Store Name', items = { ... }, cash = 1000, bank = 5000, locale = { ... }, categories = { ... }, config = { ... }, })

\-- Close market UI SendNUIMessage({ action = 'closeMarket' })

***

### NUI Callbacks

\-- Close market (from UI) RegisterNUICallback('closeMarket', function(\_, cb) cb('ok') end)

\-- Purchase (from UI) RegisterNUICallback('purchase', function(data, cb) -- data.items, data.method, data.total cb('ok') end)


---

# 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://elena-scripts.gitbook.io/elenascripts/economy/shop/events-exports.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.
