DirkScripts Logo

Login With FiveM

Login

πŸ“š Dirk Lib
β€Ί
Modules
β€Ί
ui
β€Ί

Quiz

Quiz

Multi-question quiz system with pass/fail and retake controls.

lib.registerQuiz (Server)

lua
lib.registerQuiz('driving_test', {
    title = 'Driving Theory Test',
    time = 120,
    timeout = 3600,
    passMark = 8,
    answerAll = true,
    canRetake = true,
    secureMode = true,
    questions = {
        {
            type = 'single',
            question = 'What does a red light mean?',
            options = { 'Stop', 'Go', 'Slow down' },
            correct = 1,
        },
    },
})
FieldTypeRequiredDescription
titlestringyesQuiz title
timenumberyesQuiz duration in seconds
timeoutnumberyesCooldown before retake
passMarknumberyesScore required to pass
answerAllbooleanyesRequire all questions to be answered
questionstable[]yesQuiz questions
canRetakebooleannoAllow players to retake
secureModebooleannoHide correct answers from client payload

Each question supports:

  • type: single, multiple, text, or number
  • question: prompt string
  • options: answer options (where applicable)
  • correct: correct answer value

lib.startQuiz (Client)

lua
local ok, info = lib.startQuiz('driving_test')

Returns ok, info where ok is true/false and info is quiz payload or failure reason.

lib.closeQuiz (Client)

lua
lib.closeQuiz()

lib.getQuiz / lib.deleteQuiz (Server)

lua
local quiz = lib.getQuiz('driving_test')
lib.deleteQuiz('driving_test')

Copyright Β© 2026 DirkScripts.

Not affiliated with or endorsed by Rockstar North, Take-Two Interactive, or any other rights holders. FiveM is a copyright and registered trademark of Take-Two Interactive Software, Inc.
Our checkout system is provided by Tebex Limited, who manage payment processing, product delivery, and billing support. Prices shown in currencies other than GBP are approximate conversions updated daily. All purchases are processed in GBP, so the final amount charged may vary depending on your bank or payment provider’s exchange rate.