# cancelLatentEvent (Server)

> Stops a latent event the server is sending to a player. The client drops what it had received and the event is not triggered there.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Server
- **Category**: Events
- **URL**: https://wiki.mymp.gg/en/cancelLatentEvent-server
- **Counterpart**: Also exists on the client, with its own implementation: [cancelLatentEvent (Client)](https://wiki.mymp.gg/en/cancelLatentEvent-client.md)

## Syntax

```lua
bool cancelLatentEvent(player thePlayer, int handle)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `thePlayer` | `player` | The player receiving the event. |
| `handle` | `int` | A handle from `getLatentEventHandles` for that player. |

## Returns

`true` if it was cancelled, `false` if the handle does not exist for that player or the transfer already finished.

## Example

```lua
addCommandHandler("skipdownload", function(player)
    for _, handle in ipairs(getLatentEventHandles(player)) do
        cancelLatentEvent(player, handle)
    end
end)
```

## See also

- [getLatentEventHandles (Server)](https://wiki.mymp.gg/en/getLatentEventHandles-server.md): Lists the latent events the server is still sending to a player.
- [getLatentEventStatus (Server)](https://wiki.mymp.gg/en/getLatentEventStatus-server.md): Tells how a latent event the server is sending to a player is going.
- [triggerLatentClientEvent (Server)](https://wiki.mymp.gg/en/triggerLatentClientEvent.md): Sends an event to the players' clients bit by bit, in the background, at no more than bandwidth bytes a second per player. Meant for large data that must not hold up the rest of the traffic.
