> For the complete documentation index, see [llms.txt](https://goumil-studio.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://goumil-studio.gitbook.io/docs/script-esx/gsb_keypad.md). Agents can also search and read this documentation through its [MCP server](https://goumil-studio.gitbook.io/docs/~gitbook/mcp).

# GSB\_keypad

## GSB Keypad — Documentation

> Keypad UI modulaire pour FiveM — 8 thèmes, sons, multilingue. Modular keypad UI for FiveM — 8 themes, sounds, multilingual.

***

<figure><img src="https://446711221-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fiv00pFOJMUcebdh60ZvY%2Fuploads%2FJhz0Sa5Vn1v8iZw49yG7%2FCapture%20d%E2%80%99%C3%A9cran%202026-05-03%20133644.png?alt=media&amp;token=1d222a92-b575-4507-a200-b781abdd869a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://446711221-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fiv00pFOJMUcebdh60ZvY%2Fuploads%2FWoKUKFZkOlmrVwYjc40w%2Fcode.png?alt=media&amp;token=cb47f776-3fd6-44b1-8cd3-c3ff928b33cb" alt=""><figcaption></figcaption></figure>

### Sommaire / Table of Contents

1. Introduction
2. Installation
3. Configuration
4. Exports & API
5. Thèmes / Themes
6. Commandes / Commands

***

### Introduction

GSB Keypad est une interface de saisie de code PIN entièrement personnalisable pour FiveM. Il s'intègre dans n'importe quel script via un simple export et retourne le code saisi. Aucune logique métier embarquée — tu branches ta propre vérification.

GSB Keypad is a fully customizable PIN code input UI for FiveM. It integrates into any script through a simple export and returns the entered code. No business logic embedded — you plug in your own verification.

#### Fonctionnalités / Features

|                                               |                                                                         |
| --------------------------------------------- | ----------------------------------------------------------------------- |
| 🎨 **8 thèmes visuels / 8 visual themes**     | cyberpunk, terminal, military, minimal, industrial, arctic, neon, vault |
| 🔊 **Sons intégrés / Built-in sounds**        | touche, accepté, refusé / key, accept, reject                           |
| 🌍 **4 langues / 4 languages**                | français, english, deutsch, español                                     |
| 🔢 **Code libre / Free length**               | de 4 à 8 chiffres / 4 to 8 digits                                       |
| 🌫️ **Flou d'arrière-plan / Background blur** | immersion à l'ouverture / on open                                       |
| 🖥️ **Preview admin / Admin preview**         | grille des 8 thèmes via `/keypad_themes`                                |

***

### Installation

#### Prérequis / Requirements

* [ox\_lib](https://github.com/overextended/ox_lib)
* Framework : ESX Legacy ou QB-Core (configurable) / ESX Legacy or QB-Core (configurable)

#### Étapes / Steps

**1. Placer la ressource / Place the resource**

Copie le dossier `GSB_keypad` dans `resources/`. Copy the `GSB_keypad` folder into `resources/`.

**2. Déclarer dans server.cfg / Declare in server.cfg**

```
ensure ox_lib
ensure GSB_keypad
```

> ⚠️ GSB\_keypad doit être démarré **avant** les scripts qui l'utilisent. ⚠️ GSB\_keypad must be started **before** scripts that use it.

**3. Configurer / Configure**

Ouvre `config.lua` et ajuste les valeurs selon ton serveur. Open `config.lua` and adjust the values for your server.

**4. Production — supprimer les fichiers de test / Remove test files**

Le dossier `test/` contient des commandes de démonstration. Supprime-le avant mise en production. The `test/` folder contains demo commands. Delete it before going live.

```
GSB_keypad/test/   ← à supprimer / delete before production
```

***

### Configuration

Le fichier `config.lua` est non chiffré — modifiable librement par l'acheteur. The `config.lua` file is not encrypted — freely editable by the buyer.

#### `Config.Theme`

Thème affiché par défaut. / Default theme displayed.

```lua
Config.Theme = 'cyberpunk'
-- Options : 'cyberpunk' | 'terminal' | 'military' | 'minimal' | 'industrial' | 'arctic' | 'neon' | 'vault'
```

#### `Config.Locale`

Langue de l'interface. / UI language.

```lua
Config.Locale = 'fr'
-- Options : 'fr' | 'en' | 'de' | 'es'
```

#### `Config.SoundEnabled` / `Config.SoundVolume`

```lua
Config.SoundEnabled = true
Config.SoundVolume  = 0.5   -- 0.0 (muet / mute) → 1.0 (max)
```

#### `Config.BackgroundBlur`

Flou progressif de l'arrière-plan à l'ouverture. / Progressive background blur on open.

```lua
Config.BackgroundBlur = true
```

#### `Config.IsAdmin`

Fonction de vérification admin pour `/keypad_themes`. À adapter selon ton framework. Admin verification function for `/keypad_themes`. Adapt to your framework.

**ESX (défaut / default)**

```lua
Config.IsAdmin = function()
    local xPlayer = exports['es_extended']:getSharedObject().GetPlayerData()
    return xPlayer.group == 'admin' or xPlayer.group == 'superadmin'
end
```

**QB-Core**

```lua
Config.IsAdmin = function()
    local QBCore = exports['qb-core']:GetCoreObject()
    return QBCore.Functions.GetPlayerData().permission == 'admin'
end
```

**Sans framework / No framework (ACE)**

```lua
Config.IsAdmin = function()
    return IsPlayerAceAllowed(PlayerId(), 'command.keypad_themes')
end
```

***

### Exports & API

Tous les exports sont côté client. / All exports are client-side.

#### `OpenKeyPad(theme?)`

Ouvre le keypad et attend la saisie. Bloquant — le thread se met en pause jusqu'à validation ou annulation. Opens the keypad and waits for input. Blocking — the thread pauses until confirmation or cancellation.

```lua
local success, code = exports['GSB_keypad']:OpenKeyPad(theme)
```

| Paramètre / Parameter | Type                              | Description                                                                            |
| --------------------- | --------------------------------- | -------------------------------------------------------------------------------------- |
| `theme`               | `string` *(optionnel / optional)* | Thème à utiliser. Si omis → `Config.Theme` / Theme to use. If omitted → `Config.Theme` |

| Retour / Return | Type          | Description                                                    |
| --------------- | ------------- | -------------------------------------------------------------- |
| `success`       | `bool`        | `true` = code saisi / entered, `false` = annulé / cancelled    |
| `code`          | `string\|nil` | Code saisi, `nil` si annulé / Code entered, `nil` if cancelled |

***

#### `Accept()`

Déclenche l'animation et le son "accepté" (LED verte). Triggers the "accepted" animation and sound (green LED).

```lua
exports['GSB_keypad']:Accept()
```

***

#### `Reject()`

Déclenche l'animation et le son "refusé" (LED rouge). Triggers the "rejected" animation and sound (red LED).

```lua
exports['GSB_keypad']:Reject()
```

***

#### `CloseKeyPad()`

Ferme le keypad sans animation. / Closes the keypad without animation.

```lua
exports['GSB_keypad']:CloseKeyPad()
```

***

#### Exemple complet / Full example

Pattern recommandé avec feedback sonore et fermeture propre. Recommended pattern with sound feedback and clean close.

```lua
local success, code = exports['GSB_keypad']:OpenKeyPad('arctic')

-- Annulé / Cancelled
if not success then
    exports['GSB_keypad']:CloseKeyPad()
    return
end

-- Vérification / Verification
if code == monPinSauvegardé then
    exports['GSB_keypad']:Accept()           -- son OK + LED verte / OK sound + green LED
else
    exports['GSB_keypad']:Reject()           -- son erreur + LED rouge / error sound + red LED
end

Citizen.Wait(900)                            -- laisser l'animation / let animation play
exports['GSB_keypad']:CloseKeyPad()
```

***

### Thèmes / Themes

Chaque thème a ses propres couleurs, animations et ambiance. Le thème est passé à l'export à l'ouverture — tu peux en utiliser plusieurs dans le même script selon le contexte.

Each theme has its own colors, animations and atmosphere. The theme is passed to the export on open — you can use multiple ones in the same script depending on context.

| Thème / Theme | Description FR                                                            | Description EN                                                          |
| ------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| `cyberpunk`   | Violet et rose néon, effets scanlines. Zones urbaines, hackings.          | Neon purple and pink, scanline effects. Urban areas, hacking.           |
| `terminal`    | Texte vert monospace sur fond noir. Style terminal informatique.          | Green monospace text on black. Computer terminal style.                 |
| `military`    | Tons kaki et vert militaire. Bases, armureries, zones sécurisées.         | Khaki and military green. Bases, armories, secure zones.                |
| `minimal`     | Blanc et gris épuré, sans fioriture. Appartements modernes, entreprises.  | Clean white and grey, no frills. Modern apartments, offices.            |
| `industrial`  | Rouille et acier. Entrepôts, garages, zones de stockage.                  | Rust and steel. Warehouses, garages, storage areas.                     |
| `arctic`      | Tons glacés, bleu pâle, effets givre. Laboratoires, bunkers.              | Icy tones, pale blue, frost effects. Labs, bunkers.                     |
| `neon`        | Couleurs saturées multicolores, style arcade. Zones de vie nocturne.      | Saturated multicolor, arcade style. Nightlife areas.                    |
| `vault`       | Doré et bronze, mécanismes tournants. Banques, coffres, stashs de valeur. | Gold and bronze, rotating mechanisms. Banks, safes, high-value stashes. |

```lua
-- Exemple : thème selon le contexte / Example: theme by context
local s, code = exports['GSB_keypad']:OpenKeyPad('military')  -- base militaire / military base
local s, code = exports['GSB_keypad']:OpenKeyPad('vault')     -- coffre / safe
local s, code = exports['GSB_keypad']:OpenKeyPad('minimal')   -- appartement / apartment
```

Utilisez `/keypad_themes` en jeu pour prévisualiser tous les thèmes en une seule grille (admin uniquement). Use `/keypad_themes` in-game to preview all themes in a single grid (admin only).

***

### Commandes / Commands

| Commande / Command       | Accès / Access             | Description                                                    |
| ------------------------ | -------------------------- | -------------------------------------------------------------- |
| `/keypad_themes`         | Admin (`Config.IsAdmin`)   | Grille de prévisualisation des 8 thèmes / 8-theme preview grid |
| `/keypad [theme]`        | Test seulement / Test only | Ouvre le keypad / Opens the keypad                             |
| `/keypad_setpin [theme]` | Test seulement / Test only | Simule un setup PIN / Simulates PIN setup                      |

> Les commandes `/keypad` et `/keypad_setpin` sont dans `test/cl_test.lua` — supprimer ce fichier en production. The `/keypad` and `/keypad_setpin` commands are in `test/cl_test.lua` — delete this file in production.

***

*GSB Keypad — Goumil Studio (GSB)*
