# Keymaster - Minigame

[**Download Here**](https://github.com/dsheedes/cd_keymaster)

[**FiveM Forums Post**](https://forum.cfx.re/t/release-keymaster-minigame-by-codesign/1790624)

[**YouTube Showcase Video**](https://youtu.be/hQwINGRIIyo)

#### Translate

* [Click here to translate this page.](https://docs-codesign-pro.translate.goog/free-scripts/keymaster-minigame?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=en-GB&_x_tr_pto=nui)
* [How do I change language?](https://gyazo.com/38606313ac9a7c290dc2c72b6793bde6)

## INSTALLATION GUIDE

**1.** Unzip the `cd_keymaster.zip` folder and place this folder in your server's resource folder.

**2.** Before starting the script, please read the `config.lua` (this is located inside the main cd\_keymaster folder) and configure the script to suit your server's needs.

### How do I use it?

#### Example 1

You can start the minigame by using the default settings.

```lua
local example = exports['cd_keymaster']:StartKeyMaster()
if example then
    print('im a winner)
else
    print('i suck so bad)
end
```

#### Example 2

Or you can use the start the minigame by sending customized settings in a table.

```lua
local CustomSettings = {
    settings = {
        handleEnd = true;  --Send a result message if true and callback when message closed or callback immediately without showing the message
        speed = 10; --pixels / second
        scoreWin = 1000; --Score to win
        scoreLose = -150; --Lose if this score is reached
        maxTime = 60000; --sec
        maxMistake = 5; --How many missed keys can there be before losing
        speedIncrement = 1; --How much should the speed increase when a key hit was successful
    },
    keys = {"a", "w", "d", "s", "g"}; --You can hash this out if you want to use default keys in the java side.
}

local example = exports['cd_keymaster']:StartKeyMaster(CustomSettings)
if example then
    print('im a winner)
else
    print('i suck so bad)
end
```

### Is the resource not working as expected?

* Make sure the name of the folder is `cd_keymaster`.
* Check the server console and the in-game F8 console for errors.
* If all else fails, contact the Codesign Team in the [Codesign Discord](https://discord.gg/HmDFGp62Tr).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.codesign.pro/free-scripts/keymaster-minigame.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
