> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaksam-scripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Modules

> Replace default features like progress bar, dispatch, and logs with your own custom modules.

Modules are an easy way for Shops Creator to replace certain default features (progress bar, dispatch, logs).

To choose an existing module, open the `/shopscreator` menu, go to settings, and choose it. That's it.

### Available Modules

| Category | Available Options                           |
| -------- | ------------------------------------------- |
| Banking  | `default`, `example`, `okokbanking`         |
| Dispatch | `codesign`, `default`, `rcore`, `roadphone` |
| Logs     | `custom`, `jaksam`                          |
| Text UI  | `esx`, `none`, `ox_lib`                     |

### Creating a Custom Module

Pick the category you want to create a module for. Each tab walks you through the exact steps for that category and gives you a ready-to-edit template.

<Tabs>
  <Tab title="Banking">
    <Steps>
      <Step title="Navigate to the modules folder">
        Go to the `shops_creator/_modules/banking` folder.
      </Step>

      <Step title="Duplicate an existing module">
        Copy an existing module (e.g. `example`) and paste it in the same folder as a template.
      </Step>

      <Step title="Rename the copy">
        Rename the pasted copy to match the integration you want to create.
      </Step>

      <Step title="Implement the required functions">
        Open the renamed file and edit it to match the events of the third-party script you're integrating:

        ```lua theme={null}
        local moduleType = "banking"
        local moduleName = "yourModuleName"

        Integrations.modules = Integrations.modules or {}
        Integrations.modules[moduleType] = Integrations.modules[moduleType] or {}
        Integrations[moduleType] = Integrations[moduleType] or {}
        Integrations[moduleType][moduleName] = {}
        table.insert(Integrations.modules[moduleType], moduleName)

        -- Returns the current money balance of the given society/business account
        Integrations[moduleType][moduleName].getSocietyMoney = function(societyName)
            -- Add your code here
        end

        -- Adds money to the given society/business account
        Integrations[moduleType][moduleName].giveMoneyToSociety = function(societyName, amount)
            -- Add your code here
        end

        -- Removes money from the given society/business account
        Integrations[moduleType][moduleName].removeMoneyFromSociety = function(societyName, amount)
            -- Add your code here
        end
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Dispatch">
    <Steps>
      <Step title="Navigate to the modules folder">
        Go to the `shops_creator/_modules/dispatch` folder.
      </Step>

      <Step title="Duplicate an existing module">
        Copy an existing module (e.g. `default`) and paste it in the same folder as a template.
      </Step>

      <Step title="Rename the copy">
        Rename the pasted copy to match the integration you want to create.
      </Step>

      <Step title="Implement the required functions">
        Open the renamed file and edit it to match the events of the third-party script you're integrating:

        ```lua theme={null}
        local moduleType = "dispatch"
        local moduleName = "yourModuleName" -- Rename to match the integration you're creating

        -- Don't touch, required to appear in in-game settings
        Integrations.modules = Integrations.modules or {}
        Integrations.modules[moduleType] = Integrations.modules[moduleType] or {}
        Integrations[moduleType] = Integrations[moduleType] or {}
        Integrations[moduleType][moduleName] = {}
        table.insert(Integrations.modules[moduleType], moduleName)

        -- Runs once per call, server side
        Integrations[moduleType][moduleName].alertPoliceServerSide = function(coords, message, category)
            if not IsDuplicityVersion() then return end

            -- Add your code here (e.g. call your dispatch script's export/event to alert police)
        end

        -- Runs client side, on every police officer's client
        Integrations[moduleType][moduleName].alertPoliceMemberClientSide = function(coords, message, category)
            if IsDuplicityVersion() then return end

            -- Add your code here (e.g. show a blip/notification to the officer)
        end
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Logs">
    <Steps>
      <Step title="Navigate to the modules folder">
        Go to the `shops_creator/_modules/logs` folder.
      </Step>

      <Step title="Duplicate an existing module">
        Copy an existing module (e.g. `jaksam`) and paste it in the same folder as a template.
      </Step>

      <Step title="Rename the copy">
        Rename the pasted copy to match the integration you want to create.
      </Step>

      <Step title="Implement the required functions">
        Open the renamed file and edit it to match the events of the third-party script you're integrating:

        ```lua theme={null}
        local moduleType = "logs"
        local moduleName = "yourModuleName"

        Integrations.modules = Integrations.modules or {}
        Integrations.modules[moduleType] = Integrations.modules[moduleType] or {}
        Integrations[moduleType] = Integrations[moduleType] or {}
        Integrations[moduleType][moduleName] = {}
        table.insert(Integrations.modules[moduleType], moduleName)

        -- Sends a log entry (e.g. to a Discord webhook or a custom logging script)
        Integrations[moduleType][moduleName].log = function(playerId, title, description, type, logType)
            -- Add your code here
        end
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Text UI">
    <Steps>
      <Step title="Navigate to the modules folder">
        Go to the `shops_creator/_modules/textui` folder.
      </Step>

      <Step title="Duplicate an existing module">
        Copy an existing module (e.g. `ox_lib`) and paste it in the same folder as a template.
      </Step>

      <Step title="Rename the copy">
        Rename the pasted copy to match the integration you want to create.
      </Step>

      <Step title="Implement the required functions">
        Open the renamed file and edit it to match the events of the third-party script you're integrating:

        ```lua theme={null}
        local moduleType = "textui"
        local moduleName = "yourModuleName"

        Integrations.modules = Integrations.modules or {}
        Integrations.modules[moduleType] = Integrations.modules[moduleType] or {}
        Integrations[moduleType] = Integrations[moduleType] or {}
        Integrations[moduleType][moduleName] = {}
        table.insert(Integrations.modules[moduleType], moduleName)

        -- Shows a text UI prompt with the given message
        Integrations[moduleType][moduleName].show = function(message)
            -- Add your code here
        end

        -- Hides the text UI prompt
        Integrations[moduleType][moduleName].hide = function()
            -- Add your code here
        end
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>


## Related topics

- [Modules](/drugs-creator/modules.md)
