Git Product home page Git Product logo

bcs_questionare's Introduction

BCS Questionare

This allows for easy exports and callbacks for configurable quizes or tests. 2022-01-16 11-41-50

Features

  • Easy export and simple clean ui
  • 0.00 ms (duh its a nui)

Preview

Preview1 Preview2

Documentation

To use the exports it has 4 parameters

exports['bcs_questionare']:openQuiz(data, questions, onsuccesscb, onfailedcb)

The data variable contains of these properties

Properties Type Description
title string Title shown at the beginning
description string Description shown at the beginning
image (optional) string Image shown at the beginning. Format must be in imagename.png
minimum number Minimum correct answer to pass the test
shuffle boolean Whether to randomize the question order or not

The questions is an array of question object that has these properties

Properties Type Description
question string The question
answers object Has answers and the correct answer properties

Example usage

local questions = {
    {
        question = 'Default Question 1',
        answers = {
            a = 'Answer is this',
            b = 'False',
            c = 'Nope',
            d = 'Not This',
            correct = 'a',
        }
    },
    {
        question = 'Default Question 2',
        answers = {
            a = 'Answer is this',
            b = 'False',
            c = 'Nope',
            d = 'Not This',
            correct = 'a',
        }
    },
    {
        question = 'Default Question 3',
        answers = {
            a = 'Answer is this',
            b = 'False',
            c = 'Nope',
            d = 'Not This',
            correct = 'a',
        }
    },
    {
        question = 'Default Question 4',
        answers = {
            a = 'Answer is this',
            b = 'False',
            c = 'Nope',
            d = 'Not This',
            correct = 'a',
        }
    }
}

exports['bcs_questionare']:openQuiz({
    title = 'License Test',
    description = 'Complete this test to get your Driver License',
    image = 'SIM',
    minimum = 1,
    shuffle = false,
}, questions, function(correct, questions)
    -- exports['hud']:sendAlert('Questionare', 'Test Passed! Answered '..correct..' out of '..questions..' question!', 'success', 3000)
    print('success', correct, questions)
end, function(correct, questions)
    -- exports['hud']:sendAlert('Questionare', 'Test Failed! Answered '..correct..' out of '..questions..' question!', 'error', 3000)
    print('failed', correct, questions)
end)

Add your image in html/images folder as a png, then you can just show the image using the image property in the data parameter

Support

Is available in my discord (No need to create a ticket) or you can create an issue here https://discord.gg/caa7xt2d8G

Contributing

Contributions are always welcome!

bcs_questionare's People

Contributors

baguscodestudio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.