# stopResource (Shared)

> Asks to stop a running resource. It stops on the next resource pulse, not during the call.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Resources and modules
- **URL**: https://wiki.mymp.gg/en/stopResource

## Syntax

```lua
bool stopResource(resource|string resource)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `resource` | `resource\|string` | The resource, or its name. |

## Returns

`true` if the stop was queued, `false` if the resource does not exist or is not running.

When it stops, the resource fires `onResourceStop` and loses its elements, timers, commands and handlers.

## Example

```lua
addCommandHandler("stopmap", function()
    stopResource("race-map")
end)
```

## See also

- [startResource (Shared)](https://wiki.mymp.gg/en/startResource.md): Starts a resource right away, after starting the resources it includes with <include> in its meta.xml.
- [restartResource (Shared)](https://wiki.mymp.gg/en/restartResource.md): Asks to stop and start again a running resource. It happens on the next resource pulse, not during the call, and the resource keeps its place in the start order.
- [onResourceStop (Server)](https://wiki.mymp.gg/en/onResourceStop.md): Fired when a resource is about to stop, while its scripts and elements still exist.
