# Systems Overview

## Architecture

Key files:

* `shared/config.lua` holds introduction settings, Stage 1 settings, plate length, parking compatibility, and localized strings.
* `server/server.lua` manages the `envi_tutorial` table, tutorial buckets, stage get and set logic, and money callbacks.
* `server/server_open.lua` handles starter vehicle creation for QBCore, Qbox, and ESX.
* `client/client_open.lua` exposes the fuel hook for your fuel script.
* escrow client files run the actual tutorial flow, entities, timers, and stage transitions.

## Database

Tutorial progress is stored in `envi_tutorial`.

The table stores:

* player identifier
* current stage

A fresh player starts at stage `0`.

A completed player is stored at the finished stage value from the script.

## Config

### Introduction

`Config.Introduction` covers:

* the intro ped
* spawn points
* intro alerts and speech
* showcase cars
* intro blurbs

### Stage 1

`Config.Stage1` covers:

* garage step
* gas station step
* bank step
* store step
* accepted item checklist

Other important config values:

* `Config.LicencePlateLength`
* `Config.AdvancedParking`
* `Config.Lang`

## Stages

### Stage 0: introduction

The player enters an isolated bucket.

They meet Professor Bonzai, inspect showcase cars, and choose a starter vehicle.

The vehicle creation path writes to the correct framework garage table through the open server file.

### Stage 1

The player is sent through the garage, fuel, bank, and shop steps.

The script validates each step before progressing.

The client flow also includes a safety timeout around 30 minutes.

## Open files

Open integration points:

* `server/server_open.lua` for garage branch logic
* `client/client_open.lua` for `GetFuel(vehicle)`

## Server callbacks

Documented callback names include:

* `envi-tutorial:start`
* `envi-tutorial:end`
* `envi-tutorial:isInTutorial`
* `envi-tutorial:getStage`
* `envi-tutorial:setStage`
* `envi-tutorial:enterBucket`
* `envi-tutorial:exitBucket`
* `envi-tutorial:getMoney`
* `envi-tutorial:chooseVehicle`

These are used by the escrow client through the bridge callback path.
