# wasEventCancelled (Shared)

> Tells whether the last event that finished running on this side was cancelled.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Events
- **URL**: https://wiki.mymp.gg/en/wasEventCancelled

## Syntax

```lua
bool wasEventCancelled()
```

## Returns

`true` if the last finished event was cancelled, else `false`.

## Example

```lua
addEvent("onShopOpen")

triggerEvent("onShopOpen", resourceRoot)
if wasEventCancelled() then
    outputDebugString("shop closed: " .. getCancelReason())
end
```

### Note

Inside a handler, the answer is about the last event that already finished, not the one running.

## See also

- [cancelEvent (Shared)](https://wiki.mymp.gg/en/cancelEvent.md): Marks the running event as cancelled. What cancelling prevents depends on the event.
- [getCancelReason (Shared)](https://wiki.mymp.gg/en/getCancelReason.md): Gives the reason passed to cancelEvent in the last event that finished running on this side.
- [triggerEvent (Shared)](https://wiki.mymp.gg/en/triggerEvent.md): Triggers an event on this side, on source. The element's own handlers and its ancestors' propagating ones are called right away, before the function returns.
