# Docs

## general stuff

**loading the client**

```lua
local client = loadstring(game:HttpGet('https://exploitsapi.pxsta.xyz/client'))()
```

**starting the client**

```lua
client.connect('user_id', 'hub_id')
```

**toggle joins (allowing other users to join you)**

```lua
client.allowJoins(state) -- default is false
```

**disconnecting from api**

```lua
client.disconnect()
```

## chat

after calling `client.connect` `client.messages` will contain the past 500 messages sent, this table will be auto updated

**message format**

```lua
{
    time = 0, -- unix time, in ms
    text = 'message content',
    user = 'name of the message author'
}
```

**sending messages**

```lua
client.sendMessage('text')
```

**on message sent**

```lua
client.onMessageReceive:Connect(function(message)
    print(message.user .. ': ' .. message.text)
end)
```

## users

after calling `client.connect` `client.users` will be a dictionary of `{ name: user }` containing every user, this dictionary will be auto updated

**user format**

```lua
{
    name = 'username',
    discord_id = 'discord id',
    online = true,
    hub = 'hub name, or null if user is offline'
}
```

**on user update**

```lua
client.onUserUpdate:Connect(function(user)
    print(user.name .. '\'s data changed' )
end)
```

**get users server**

```lua
local success, data = client.requestServer('username')

if not success then print('failed to get server, reason:', data)
else print('game:', data.place_id .. ', jobId:', data.job_id) 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://apidocs.pxsta.xyz/docs.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.
