# Shared Emotes

Two-player synchronized emotes (couples, handshakes, etc.) with a request/accept system.

***

### How it works

1. Open the emote menu and go to the **Shared** tab
2. Click a shared emote
3. The system finds the **nearest player** within range
4. A **request** is sent to the target player
5. The target sees a prompt:
   * Press `E` to **accept**
   * Press `X` to **decline**
   * Press `ALT` to **switch target** (if multiple players nearby)
6. If accepted, both players are positioned and play their respective animations

{% hint style="info" %}
If the target doesn't respond within the timeout (10 seconds by default), the request is automatically declined.
{% endhint %}

***

### Positioning

Shared emotes use sync parameters to position the two players relative to each other:

| Parameter | Description                              |
| --------- | ---------------------------------------- |
| `front`   | Distance in front of the initiator (1.0) |
| `side`    | Lateral offset (0.0)                     |
| `height`  | Vertical offset (0.0)                    |
| `heading` | Heading difference (180.1 = facing)      |

Some shared emotes also use bone attachments for precise alignment.

***

### Server validation

The server validates every shared emote request:

* **Rate limiting** -- one request per 2 seconds per player
* **Distance check** -- both players must be within `MaxRange`
* **Ped existence** -- ensures both players are spawned

***

### Config

```lua
Config.SharedEmotes = {
    MaxRange = 3.0,          -- Max distance between players
    RequestTimeout = 10,     -- Seconds before auto-decline
    AcceptControl = 51,      -- Accept key (E)
    DeclineControl = 73,     -- Decline key (X)
    CycleTargetControl = 19, -- Cycle target key (Alt)
}
```
