qb-minigames
How many times shall you fail!
Introduction
qb-minigames is a lightweight collection of skill-based minigames designed to add interactive challenges to your server's gameplay. Each minigame can be used as a standalone mechanic or embedded into scripts like robberies, hacking, crafting, or lockpicking to increase player engagement.
These minigames are implemented entirely in Lua with simple client exports, making them easy to integrate with existing qb-core resources or custom logic
Features
🧠 Quiz: Multi-question trivia with time pressure
🔡 Word Guess: Hangman-style challenge with limited mistakes
🔀 Word Scramble: Unscramble the word before time runs out
⌨️ Key Minigame: Timed key presses with fault tracking
🛠️ Lockpick: Classic lockpicking challenge with limited tries
💻 Hacking: Pattern memory and input within a time limit
🎯 Skillbar: Reaction-based challenge with difficulty and custom keys
🔢 Pinpad: Input a correct code using a keypad UI
Quiz
Presents a series of multiple-choice questions that the player must answer correctly within a time limit
questions:
tableA list of questions, each with:
question:
stringanswer:
stringoptions:
table— a list of possible answers
requiredCorrect:
numbertimePerQuestion:
number(in seconds)
local success = exports['qb-minigames']:Quiz({
{ question = 'What color is a peach?', answer = 'pink', options = { 'red', 'yellow', 'orange', 'blue', 'pink' } },
{ question = 'What color is an apple?', answer = 'red', options = { 'red', 'yellow', 'orange', 'blue', 'pink' } },
{ question = 'What color is an orange?', answer = 'orange', options = { 'red', 'yellow', 'orange', 'blue', 'pink' } },
{ question = 'What color is a banana?', answer = 'yellow', options = { 'red', 'yellow', 'orange', 'blue', 'pink' } },
{ question = 'What color is a strawberry?', answer = 'red', options = { 'red', 'yellow', 'orange', 'blue', 'pink' } },
{ question = 'What color is a blueberry?', answer = 'blue', options = { 'red', 'yellow', 'orange', 'blue', 'pink' } },
}, 3, 15)
if success then
print('success')
else
print('fail')
endWordGuess
A classic hangman-style game where the player must guess the letters of a hidden word, with a limited number of wrong guesses allowed
word:
stringhint:
stringmaxWrongGuesses:
number
local success = exports['qb-minigames']:WordGuess(
'fivem',
'the game modification you are playing on',
5
)
if success then
print('success')
else
print('fail')
endWordScramble
Presents the player with a scrambled word and a hint. The player must unscramble it within a time limit.
word:
stringhint:
stringtimeLimit:
number(in seconds)
local success = exports['qb-minigames']:WordScramble(
'fivem',
'the game modification you are playing on',
30
)
if success then
print('success')
else
print('fail')
endKeyMinigame
Requires the player to rapidly press randomly shown keys a specified number of times. Tracks incorrect inputs and early exits.
requiredPresses:
numberTotal number of correct key presses required.
local result = exports['qb-minigames']:KeyMinigame(10)
if result.quit then
print('User quit game early')
return
end
if result.faults > 3 then
print('User got more than 3 keys wrong')
endLockpick
A timed lockpicking minigame where the player must successfully pick a lock within a set number of tries.
attempts:
numberThe number of lockpick attempts the player is allowed.
local success = exports['qb-minigames']:Lockpick(5)
if success then
print('success')
else
print('fail')
endHacking
A memory-based hacking minigame where the player must solve a visual pattern challenge within a time limit.
gridSize:
numberThe number of characters in the code block the player must memorize.
timeLimit:
numberTime (in seconds) to solve the hack.
local success = exports['qb-minigames']:Hacking(5, 30)
if success then
print('success')
else
print('fail')
endSkillbar
A reaction-based minigame where the player must press the correct keys at the right time. Supports custom difficulty and key sets.
difficulty:
string(optional)Can be
"easy","medium", or"hard". Defaults to"easy"if omitted.
keys:
string(optional)A string of allowed key inputs (e.g.
"wasd"). Defaults to"1234"if omitted.
luaCopyEdit-- Basic: uses default difficulty and keys ("easy", "1234")
local success = exports['qb-minigames']:Skillbar()
-- Medium difficulty with default keys
local success = exports['qb-minigames']:Skillbar("medium")
-- Easy difficulty with custom keys
local success = exports['qb-minigames']:Skillbar("easy", "wasdfgh")
if success then
print('success')
else
print('fail')
endPinpad
A numeric keypad minigame where the player must input the correct pin code. The minigame uses keys 1–9 and tracks user actions.
pin:
numberThe correct 4-digit code (must use digits 1–9).
luaCopyEditlocal result = exports['qb-minigames']:StartPinpad(1234)
if result.quit then
print('User quit game early')
elseif result.correct then
print('User passed game')
else
print('User failed game')
endLast updated
Was this helpful?
