Maze

Creates and displays a number maze minigame with configurable parameters.

Parameters:

  • callback (function|boolean): Callback function to receive the result, or false to disable callback

  • speed (number, optional): Time duration in seconds. Defaults to 10 if nil

Returns:

  • result (boolean): true if maze completed successfully, false if failed or cancelled

Exports:

  • Standard Export

    • exports.ps_lib:Maze(callback, speed)

  • PS-UI Export (Legacy Support):

    • exports['ps-ui']:Maze(callback, speed)

Usage Examples:

Now there are two ways you can use this:

USE CASE 1:

RegisterCommand('testMaze', function()
    exports.ps_lib:Maze(function(success)
        if success then
            TriggerServerEvent('ps_lib:mazeSuccess')
        end
    end, 15)
end)

This uses a function as the first parameter to run when the maze is done.

USE CASE 2:

RegisterCommand('testMaze', function()
    local success = exports.ps_lib:Maze(false, 15)
    if not success then return end
    TriggerServerEvent('ps_lib:mazeSuccess')
end)

This uses false as a first parameter to tell the minigame "we don't need a function" and it returns the result.

Both cases will work the same exact way, just different ways to handle it :)

Last updated