# onPlayerQueue (Server)

> Fired when an account is about to join the queue of a full server. Cancelling the event refuses it.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Event
- **Side**: Server
- **Category**: Players and accounts
- **Cancellable**: `cancelEvent`
- **URL**: https://wiki.mymp.gg/en/onPlayerQueue

## Syntax

```lua
addEventHandler("onPlayerQueue", root, function(string accountId, string name, string tag) ... end)
```

## Handler parameters

| Name | Type | Description |
| --- | --- | --- |
| `accountId` | `string` | The MYMP account id, the same one `setQueuePriority` takes. |
| `name` | `string` | The account's name. |
| `tag` | `string` | The account's tag, the part after the `#`. |

## Source

The root element (`root`). The player does not exist yet.

When a seat frees up, it is held for 60 seconds for the first in line, and nobody joins ahead of the queue.

## Example

```lua
local banned = { ["c3f1a2"] = true }

addEventHandler("onPlayerQueue", root, function(accountId, name, tag)
    if banned[accountId] then
        cancelEvent()
    end
end)
```

## See also

- [setQueuePriority (Server)](https://wiki.mymp.gg/en/setQueuePriority.md): Sets an account's priority in a full server's queue. A higher priority goes first.
- [getPlayerAccount (Server)](https://wiki.mymp.gg/en/getPlayerAccount.md): Returns the MYMP account the player joined with.
- [onPlayerJoin (Server)](https://wiki.mymp.gg/en/onPlayerJoin.md): Fired when a player has finished joining and has received the server's initial state.
