VarHack

Creates and displays a variable hacking minigame with configurable parameters.
Parameters:
callback
(function|boolean): Callback function to receive the result, orfalse
to disable callbackblocks
(number, optional): Number of blocks in the game (1-15). Defaults to 5 if nil or out of rangespeed
(number, optional): Speed/duration of the game in milliseconds. Defaults to 3000 if nil or less than 2
Returns:
result
(boolean):true
if VarHack completed successfully,false
if failed or cancelled
Exports:
Standard Export:
exports.ps_lib:VarHack(callback, blocks, speed)
PS-UI Export (Legacy Support):
exports['ps-ui']:VarHack(callback, blocks, speed)
Usage Examples:
Now there are two ways you can use this:
USE CASE 1:
RegisterCommand('testVarHack', function()
exports.ps_lib:VarHack(function(success)
if success then
TriggerServerEvent('ps_lib:varHackSuccess')
end
end, 8, 5000)
end)
This uses a function as the first parameter to run when the VarHack is done.
USE CASE 2:
RegisterCommand('testVarHack', function()
local success = exports.ps_lib:VarHack(false, 8, 5000)
if not success then return end
TriggerServerEvent('ps_lib:varHackSuccess')
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