> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-shooting-range/permissions.md).

# Permissions and Admin Commands

Admin access for the RedM Shooting Range & Competition script: ACE permission, VORP groups, RSG permissions and every /shootingadmin command.

Players need no permission at all. Anyone with a loaded character can open the range menu, shoot, wager, practise and enter tournaments.

Admin access is only needed for `/shootingadmin` and for the admin button in the tournament screen.

## Who counts as an admin

A player is an admin if **any** of these is true:

1. They have the ACE permission set in `Config.AdminAce` (default `shootingrange.admin`).
2. On **VORP Core**, their user group or their character's group is listed in `Config.AdminGroups`.
3. On **RSG Core**, `RSGCore.Functions.HasPermission` returns true for one of the entries in `Config.AdminGroups`.

The server console and RCON are always admin.

```lua
Config.AdminCommand = 'shootingadmin'
Config.AdminAce = 'shootingrange.admin'
Config.AdminGroups = { 'admin', 'superadmin' }
```

### Granting the ACE permission

```cfg
add_ace group.admin shootingrange.admin allow
```

To give it to one player only:

```cfg
add_principal identifier.license:YOUR_LICENSE group.admin
```

## Admin commands

All admin commands are subcommands of `/shootingadmin`. Change the command name with `Config.AdminCommand`.

| Command                                     | What it does                                                                                                                                                                                                 |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `/shootingadmin draw`                       | Closes tournament sign ups now and makes the bracket. Needs at least 2 entrants.                                                                                                                             |
| `/shootingadmin reset`                      | Cancels the current tournament, stops any tournament match in progress and refunds every entry fee if no champion was crowned yet. A fresh tournament opens straight away.                                   |
| `/shootingadmin cancel <player id>`         | Cancels whatever that player is in. A match is cancelled and every stake refunded. A practice run is stopped. A lobby is closed and everyone in it is refunded.                                              |
| `/shootingadmin here <range id>`            | Measures the spot you are standing on as the firing line of a range and saves a ready to paste config line. See [Shooting Ranges](/script-documentation/cas-shooting-range/ranges.md#measuring-a-new-range). |
| `shootingadmin here <range id> <player id>` | Console or RCON only. Measures where that player is standing.                                                                                                                                                |
| `shootingadmin avatars`                     | Console or RCON only. Lists every player session and the Steam picture it found. Useful when portraits do not show.                                                                                          |

Without a valid subcommand, the command prints its usage.

## Admin tools in the menu

When an admin opens the **Tournament** screen during sign ups, they get a button to make the draw right away, the same as `/shootingadmin draw`.

## Tips

* Use `cancel` if a match gets stuck because of a crash on one side. It refunds everyone, so nobody loses money.
* Use `reset` before a planned restart if a tournament is still in sign ups, so players see the refund in game instead of on their next login.
