Thermite
Creates and displays a thermite minigame with configurable parameters.
Parameters:
cb
(function|boolean): Callback function to receive the result, orfalse
to disable callbacktime
(number, optional): Time duration in seconds. Defaults to 10 if nilgridsize
(number, optional): Size of the game grid (5-10). Defaults to 6 if nil or ≤5wrong
(number, optional): Maximum number of incorrect answers allowed. Defaults to 3 if nilcorrectBlocks
(number, optional): Number of correct blocks to display. Auto-calculated based on grid size if nil
Returns:
result
(boolean):true
if thermite completed successfully,false
if failed or cancelled
Exports:
Standard Export:
exports
.ps_lib:Thermite(cb, time, gridsize, wrong, correctBlocks)
PS-UI Export (Legacy Support):
exports['ps-ui']:Thermite(cb, time, gridsize, wrong, correctBlocks)
Usage Examples:
Now there are two ways you can use this:
USE CASE 1:
RegisterCommand('testThermite', function()
exports.ps_lib:Thermite(function(success)
if success then
TriggerServerEvent('ps_lib:thermiteSuccess')
end
end, 150, 6, 3)
end)
This uses a function as the first parameter to run when the thermite is done.
USE CASE 2:
RegisterCommand('testThermite', function()
local success = exports.ps_lib:Thermite(false, 150, 6, 3)
if not success then return end
TriggerServerEvent('ps_lib:thermiteSuccess')
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