Scrambler

Creates and displays a scrambler minigame with configurable parameters.
Parameters:
callback
(function|boolean): Callback function to receive the result, orfalse
to disable callbacktype
(string, optional): Type of scrambler game ("alphabet", "numeric"). Defaults to "alphabet" if niltime
(number, optional): Time duration in seconds. Defaults to 10 if nilmirrored
(number, optional): Mirrored text option (0: Normal, 1: Normal + Mirrored, 2: Mirrored only). Defaults to 0 if nil
Returns:
result
(boolean):true
if scrambler completed successfully,false
if failed or cancelled
Exports:
Standard Export:
exports
.ps_lib:Scrambler(callback, type, time, mirrored)
PS-UI Export (Legacy Support):
exports['ps-ui']:Scrambler(callback, type, time, mirrored)
Usage Examples:
Now there are two ways you can use this:
USE CASE 1:
RegisterCommand('testScrambler', function()
exports.ps_lib:Scrambler(function(success)
if success then
TriggerServerEvent('ps_lib:scramblerSuccess')
end
end, "numeric", 20, 0)
end)
This uses a function as the first parameter to run when the scrambler is done.
USE CASE 2:
RegisterCommand('testScrambler', function()
local success = exports.ps_lib:Scrambler(false, "numeric", 20, 0)
if not success then return end
TriggerServerEvent('ps_lib:scramblerSuccess')
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