> For the complete documentation index, see [llms.txt](https://pinkfrog.gitbook.io/pinkfrog.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pinkfrog.gitbook.io/pinkfrog.io/assets-and-guides/advanced-business-creator/installation-guide.md).

# Installation Guide

***

### 1. Requirements

| Resource                                             | Needed          | Why                                                                                        |
| ---------------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------ |
| [`oxmysql`](https://github.com/overextended/oxmysql) | **Required**    | Every business, point, recipe and order is stored in your database.                        |
| [`ox_lib`](https://github.com/overextended/ox_lib)   | **Required**    | Notifications, progress bars, text prompts, keybinds, animation loading and the clipboard. |
| A framework                                          | **Required**    | `qbx_core`, `qb-core` or `es_extended`. Detected automatically.                            |
| An inventory                                         | **Recommended** | `ox_inventory` (best) or `qb-inventory`. Stashes and items need one.                       |

Optional, but supported out of the box:

| Resource                                                                | What it adds                                                         |
| ----------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `ox_target` / `qb-target`                                               | Look-at interaction. Without one, points fall back to `[E]` prompts. |
| `xsound`                                                                | Music from the boombox point.                                        |
| `illenium-appearance`, `fivem-appearance`, `qb-clothing`, `esx_skin`    | Company uniforms in the cloakroom.                                   |
| `Renewed-Banking`, `qb-banking`, `okokBanking`, `esx_society`           | Mirrors the company balance into the bank account.                   |
| `qbx_vehiclekeys`, `qb-vehiclekeys`, `wasabi_carlock`, `mk_vehiclekeys` | Keys for company vehicles taken out of the garage.                   |

{% hint style="info" %}
Nothing in the optional list is required to start. Each one is detected at runtime, and anything missing simply does less - it never errors.
{% endhint %}

### 2. Install the resource

1. Drop the `pinkFrog_businessCreator` folder into your resources. The panels ship already built in `html/dist`, so there is nothing to compile.
2. Add it to your `server.cfg` **after** its dependencies:

```cfg
ensure oxmysql
ensure ox_lib
ensure ox_inventory      # or other inventory
ensure ox_target         # optional
ensure pinkFrog_businessCreator
```

{% hint style="warning" %}
Keep the folder name. Every export is called as `exports.pinkFrog_businessCreator:...`, so renaming the folder renames every call in your other scripts too.
{% endhint %}

### 3. Database

There is nothing to import. On the first start the resource creates every table it needs through `oxmysql`, and later updates add their own columns the same way. Watch the console on first boot: any SQL problem is printed there in full.

### 4. Add the items

The resource uses two items of its own. Both are prepared for you in `toInstall/`.

**With `ox_inventory`:**

1. Open `toInstall/ox_inventory_items.lua` and copy the `receipt` and `business_tablet` entries into `ox_inventory/data/items.lua`.
2. Copy `toInstall/receipt.png` and `toInstall/business_tablet.png` into `ox_inventory/web/images/`.

| Item              | Required | What it does                                                       |
| ----------------- | -------- | ------------------------------------------------------------------ |
| `receipt`         | **Yes**  | The printed receipt a customer can ask for when paying an invoice. |
| `business_tablet` | No       | Opens the business computer from the inventory.                    |

The same file ends with four example pawnshop goods (`goldchain`, `rolex`, `diamond_ring`, `goldbar`). They are only the default buy list of a pawnshop: skip them if you run none, or already have items of your own to pawn. No pictures are shipped for those four.

Both names are configurable in `shared/config.lua`:

```lua
Config.items = {
    receipt = 'receipt',
    tablet  = 'business_tablet',
}

-- The tablet item and the /business command can be enabled separately.
Config.tablet = {
    enabled = true,   -- false = the item is dead, command only
    command = true,   -- false = the item is the only way in
}
```

{% hint style="info" %}
`ox_inventory` calls an export named after the item, so if you rename an item in the config, use that same name in `items.lua` - both as the item's key and at the end of its `server.export` line. Without `ox_inventory` the items are registered as the framework's own usable items (QBox, QBCore, ESX). The hooks live in `server/custom/server_editable.lua` - adapt them there for anything else.
{% endhint %}

### 5. Check the config

Open `shared/config.lua`. Most of it can stay as it is; these are the lines worth reading before you start.

```lua
Config.frameworkType = 'AUTO'          -- AUTO | QBOX | QBCore | ESX | CUSTOM
Config.useLocale     = 'en'            -- en | pl
Config.target        = 'auto'          -- auto | ox_target | qb-target | own | none
Config.banking       = 'auto'          -- auto | none | a named banking resource

-- Who may open the creator panel
Config.adminCommand     = 'businesscreator'
Config.adminGroups      = { 'admin', 'superadmin', 'god' }
Config.adminIdentifiers = {}           -- optional hard whitelist

-- The accent colour of /bc and every player panel
Config.mainThemeAdminPanel = '#8662FC'

Config.debug = false                   -- true prints a lot; leave off in production
```

### 6. First run

Start the server and, in game, run:

```
/businesscreator      (or the shorter /bc)
```

Then build your first business:

1. **Create** - press `+` in the sidebar, give it a name and the framework job that works there. The job is required: ranks, duty and permissions all hang off it.
2. **Zone & Blips** - walk the outline of the building, dropping a corner with `ENTER` at each turn and finishing with `E` once there are at least three, then set the blip.
3. **Points** - place what the place needs. A restaurant usually wants a duty point, a stash, a crafting station, a register, a business computer and an order screen.
4. **Crafting** - add recipes: what comes out, what goes in, how long it takes.
5. **Shop** - price what the register sells and what the ingredient store buys.
6. **Staff** - set the ranks and what each one may do.
7. **General** - hand the business to its owner by server id.

The owner can now open `/business`, clock in, and the shop is live.

{% hint style="success" %}
In a hurry? `toInstall/ReadyBusinesses/` holds finished item lists for eight food businesses, plus shared ingredients and a `crafting.md` with every recipe written out. Add those items to your inventory and the menus are done.
{% endhint %}

### Commands

| Command                   | Who                               | What it does                                                                                                                                 |
| ------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `/businesscreator`, `/bc` | Admin                             | The creator panel.                                                                                                                           |
| `/business`               | Staff whose rank holds `bossmenu` | The business computer, as a tablet. Not registered when `Config.tablet.command` is `false`.                                                  |
| `/orders`                 | Staff on duty                     | The kitchen pass - tickets waiting to be made.                                                                                               |
| `/pforders`               | Staff on duty                     | The draggable Active Orders overlay. Bound to `O` by default.                                                                                |
| `/duty [businessId]`      | Staff                             | Clock in and out without walking to the duty point. The id is only needed when you work at more than one business and stand in none of them. |
| `/storevehicle`           | Staff on duty                     | Park the company vehicle you are sitting in.                                                                                                 |
| `/pftargets`              | Anyone                            | Draw every interaction zone, for placement work. Only on your own screen.                                                                    |
| `/pfwhy`                  | Anyone                            | Why a point near you is or is not offering its option. Printed to your `F8` console.                                                         |
| `/pfmoney`                | Admin, in game                    | Prove the money bridge works, and print each business's employee cut. Printed to the **server** console.                                     |

`/pftargets` and `/pfwhy` are built for admins but not locked to them: both only show what that player's own game already knows.

### Server console

Run these from the server console, or in game as an admin - either way the answer is printed to the **server** console:

```
pfbusiness list                       -- every business, balance and open state
pfbusiness reload                     -- re-read everything from the database
pfbusiness npc <id>                   -- why walk-in customers are or are not arriving
pfbusiness perms <businessId> <serverId> [flag]
pfbusiness export <id|all>            -- write a blueprint to data/*.json
pfbusiness import <file>              -- create businesses from a blueprint
pfbusiness typereset <key>            -- restore a business type to its config seed
pfbusiness seatreach [metres]         -- resize every seating table's target
pfbusiness delete <id>                -- delete a business and everything on it
```

### Which files may I edit?

| File                                | Edit it?                                                                   |
| ----------------------------------- | -------------------------------------------------------------------------- |
| `shared/config.lua`                 | **Yes** - this is where you configure everything.                          |
| `shared/locales/*.lua`              | **Yes** - translations and wording.                                        |
| `client/custom/client_editable.lua` | **Yes** - the client-side bridge.                                          |
| `server/custom/server_editable.lua` | **Yes** - the server-side bridge: framework, inventory, money, keys, logs. |
| `server/server.lua`                 | **Yes** - the open server core, in labelled sections.                      |
| Everything else                     | Leave it.                                                                  |

### Troubleshooting

**A point gives no prompt.** Stand next to it, run `/pfwhy` and open `F8`. It prints, point by point, the exact reason each one is or is not shown - wrong job, off duty, missing permission, out of range.

**Nobody clocks in / the business is always closed.** A business is *open* while at least one employee is on duty. Check the linked job matches the framework job, then `pfbusiness perms <businessId> <serverId>`.

**No walk-in customers.** `pfbusiness npc <id>` lists every condition and which one is failing - usually a missing route, an empty price list, or nobody on shift.

**Money is not moving.** `/pfmoney` pays you $1 in cash and $1 in the bank, takes it back, and prints what actually changed to the server console, which separates a bridge problem from a config one.

***

Next: Exports
