> For the complete documentation index, see [llms.txt](https://docs.0resmon.org/0resmon/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.0resmon.org/0resmon/0r-resources/0r-gps-v3/exports-events.md).

# Exports/Events

## Client exports

### toggleGPS

Open, close or toggle the handheld GPS UI.

```lua
-- Toggle current state
exports['0r-gps']:toggleGPS()

-- Force open
exports['0r-gps']:toggleGPS(true)

-- Force close
exports['0r-gps']:toggleGPS(false)
```

#### Parameters

| Name  | Type     | Description                                           |
| ----- | -------- | ----------------------------------------------------- |
| state | boolean? | Optional forced state. `true` = open, `false` = close |

#### Returns

| Type    | Description                           |
| ------- | ------------------------------------- |
| boolean | Current visibility state after toggle |

***

### isOpen

Returns whether the GPS UI is currently open.

```lua
local isOpen = exports['0r-gps']:isOpen()
```

#### Returns

| Type    | Description          |
| ------- | -------------------- |
| boolean | GPS visibility state |

***

### getChannelId

Returns the current connected channel ID.

```lua
local channelId = exports['0r-gps']:getChannelId()
```

#### Returns

| Type   | Description                                   |
| ------ | --------------------------------------------- |
| number | Current frequency ID, or `0` if not connected |

***

### getChannelMembers

Returns all members currently synced in the active channel.

```lua
local members = exports['0r-gps']:getChannelMembers()

for _, serverId in pairs(members) do
    print(serverId)
end
```

#### Returns

| Type  | Description                |
| ----- | -------------------------- |
| table | Array of member server IDs |

***

### joinChannel

Join a GPS channel.

```lua
local success = exports['0r-gps']:joinChannel(1)

local success = exports['0r-gps']:joinChannel(1, 'mypassword')
```

#### Parameters

| Name      | Type    | Description                 |
| --------- | ------- | --------------------------- |
| channelId | number  | Target channel/frequency ID |
| password  | string? | Optional channel password   |

#### Returns

| Type    | Description                        |
| ------- | ---------------------------------- |
| boolean | Whether the join request succeeded |

***

### leaveChannel

Leave the current GPS channel.

```lua
local success = exports['0r-gps']:leaveChannel()
```

#### Returns

| Type    | Description               |
| ------- | ------------------------- |
| boolean | Whether leaving succeeded |

***

## Useable Events

**Client**

| Event                     | Purpose                        |
| ------------------------- | ------------------------------ |
| `0r-gps:client:toggleGPS` | Open GPS UI (from usable item) |

***

## State bags

Useful for other scripts that read player state:

| Bag             | Values                                                                         |
| --------------- | ------------------------------------------------------------------------------ |
| `gpsStatus`     | `foot`, `vehicle`, `boat`, `plane`, `motorcycle`, `bike`, `helicopter`, `dead` |
| `gpsSiren`      | `true` / `false` — emergency lights                                            |
| `gpsPunishment` | `true` when water punishment (coord punishment) is active                      |


---

# 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.0resmon.org/0resmon/0r-resources/0r-gps-v3/exports-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.
