> 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-horse-racing/troubleshooting.md).

# Troubleshooting

Fix common CAS Horse Racing issues — the menu not opening, a missing New Race button, a stuck race, empty prompt boxes and winnings owed to offline players.

## The menu does not open

Check your console for a script error. If there is none, check that `oxmysql` started before this resource:

```cfg
ensure oxmysql
ensure cas-horserace
```

## The New Race button is missing

Your permission is not set. Add this to `server.cfg` and restart:

```cfg
add_ace group.admin cas.raceeditor allow
```

See [Permissions](/script-documentation/cas-horse-racing/permissions.md).

## Nothing happened when the race started

Standing at the start line is not enough. You have to enter the race first.

1. Walk up to the race master and press **E**, or type `/races`.
2. Press **Enter** on the race.
3. Be on a horse.
4. Be within 60 metres of the start line when the time comes.

If you are near the line and not entered you will be warned, and warned again in the last minute.

## The race disappeared and nothing ran

Fewer riders were at the line than `Config.Lobby.minRiders`, so it was called off and everyone was refunded. Everybody on the server is told when this happens.

Lower the setting if you are testing alone:

```lua
Config.Lobby.minRiders = 1
```

Put it back before going live.

## The race master faces the wrong way

Check the heading shown at the top of the screen while placing him. The arrow keys turn him and the number changes as you press them.

If the number does not change, the arrow keys are being taken by another resource. See [Changing the keys](/script-documentation/cas-horse-racing/commands.md#changing-the-keys).

## I cannot get out of the sky camera

Press **ESC** or **Backspace**. **Q** also works.

## Empty boxes in the text above a race master

The game's own font only has plain English letters. Accented or special characters appear as boxes.

This only affects text the game draws, such as prompts and blip names. Text in the menu is unaffected because it uses its own fonts.

## The map in the menu is blank

The map uses Rockstar's tile server. If your players cannot reach it, a simple line drawing is shown instead. Nothing is broken and no setting fixes it.

## A race is stuck

If a race is in the table with status `running` and is not in the game, restart the resource. Interrupted races are cleared on start, entry fees are refunded, and bets are returned.

```
restart cas-horserace
```

## A player says they were not paid

Money owed to someone who was offline is held until they come back. It is paid the next time they open `/races`.

To check:

```sql
SELECT * FROM cas_horserace_owed;
```

The row is deleted as the money is handed over, so nothing is ever paid twice.

## Resetting everything

This deletes all races, results, standings, and unpaid money. There is no undo.

```sql
DROP TABLE cas_horserace_owed;
DROP TABLE cas_horserace_bets;
DROP TABLE cas_horserace_entries;
DROP TABLE cas_horserace_races;
```

Restart the resource. The tables are rebuilt empty.

## Getting more detail

```lua
Config.Debug = true
```

Restart the resource. The console will show what is happening. Turn it back off when you are done.
