# Changing minigame for Cigarette packaging

## Overview

* By default we use our own minigame for the cigarette packagging, but we understand that you might like to change to use different ones.

## Location

Path: `rcore_prison/modules\base\client\api\cl-minigames.lua`

## Guide

1. You just need to remove the StartCigarProduction function.
2. Use minigame exports which you want to integrate
3. On the success callback you need to set this event

```lua
TriggerServerEvent('rcore_prison:server:requestCigarProductionReward', zoneId)
```

4. Done, now your minigame should be used for cigar production!

* By default state:

```lua
--- Function to start a minigame inside Prison for specific interaction place/task.
--- @param zoneId number Unique zone identifier
--- @param place string  Place type to start minigame for
function StartMinigame(zoneId, place)
    dbg.debug('Starting minigame for zoneId (%s) as place type: (%s)\nFunction path: modules/base/client/api/cl-minigames.lua', zoneId, place)

    if place == MINIGAME_PLACE_TYPE.CIGAR then
        StartCigarProduction(
            Config.Minigame.Steps or 5,
            Config.Minigame.TimeAcc or 0.3,
            Config.Minigame.AnimDict, 
            Config.Minigame.AnimName, 
            function() 
                PlaySoundFrontend(-1, "PICKUP_WEAPON_BALL", "HUD_FRONTEND_WEAPONS_PICKUPS_SOUNDSET", 0)
                TriggerServerEvent('rcore_prison:server:requestCigarProductionReward', zoneId)
                dbg.debug('RCore Minigame success!')
            end, 
            function() 
                dbg.debug('RCore Minigame failed!')
            end
        )
    end
end
```

* PS UI Example:

```lua
--- Function to start a minigame inside Prison for specific interaction place/task.
--- @param zoneId number Unique zone identifier
--- @param place string  Place type to start minigame for
function StartMinigame(zoneId, place)
    dbg.debug('Starting minigame for zoneId (%s) as place type: (%s)\nFunction path: modules/base/client/api/cl-minigames.lua', zoneId, place)

    if place == MINIGAME_PLACE_TYPE.CIGAR then
      exports['ps-ui']:Circle(function(success)
         if success then
            TriggerServerEvent('rcore_prison:server:requestCigarProductionReward', zoneId)
         else
            print("fail")
         end
      end, 2, 20) -- NumberOfCircles, MS
    end
end
```


---

# 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://documentation.rcore.cz/paid-resources/rcore_prison/guides/package-cigar-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.
