Circle
Last updated
Last updated
Creates and displays a circle minigame with configurable parameters.
Parameters:
cb
(function|boolean): Callback function to receive the result, or false
to disable callback
circles
(number, optional): Number of circles to complete. Defaults to 1 if nil or less than 1
seconds
(number, optional): Time duration in seconds. Defaults to 10 if nil or less than 1
Returns:
result
(boolean): true
if all circles completed successfully, false
if failed or cancelled
The module provides the following exports for external use:
exports.ps_lib:Circle(cb, circles, seconds)
exports['ps-ui']:Circle(cb, circles, seconds)
USE CASE 1:\
RegisterCommand('testCircle', function()
exports.ps_lib:Circle(function(success)
if success then
TriggerServerEvent('ps_lib:circleSuccess')
end
end, 2, 8)
end)
This uses a function as the first parameter to run when the circle is done. USE CASE 2:\
RegisterCommand('testCircle', function()
local success = exports.ps_lib:Circle(false, 2, 8)
if not success then return end
TriggerServerEvent('ps_lib:circleSuccess')
end)
this uses false as a first parameter to tell the minigame "we dont need a function" and it returns the result Both cases will work the same exact way, just different ways to handle it :)