diff --git a/client/functions/input.lua b/client/functions/input.lua index 902c277..640ad17 100644 --- a/client/functions/input.lua +++ b/client/functions/input.lua @@ -54,6 +54,11 @@ MSK.Register('msk_core:input', function(source, header, placeholder, field) return MSK.Input.Open(header, placeholder, field) end) +MSK.Input.Active = function() + return isInputOpen +end +exports('InputActive', MSK.Input.Active) + RegisterNUICallback('submitInput', function(data) if data.input == '' then data.input = nil end if tonumber(data.input) then data.input = tonumber(data.input) end diff --git a/client/functions/main.lua b/client/functions/main.lua index 34ac6a2..febe39f 100644 --- a/client/functions/main.lua +++ b/client/functions/main.lua @@ -200,27 +200,6 @@ MSK.GetPedMugshot = function(ped, transparent) end exports('GetPedMugshot', MSK.GetPedMugshot) -MSK.Progressbar = function(time, text, color) - SendNUIMessage({ - action = 'progressBarStart', - time = time, - text = text or '', - color = color or Config.progressColor, - }) -end -MSK.ProgressStart = MSK.Progressbar -- Support for old Scripts -exports('Progressbar', MSK.Progressbar) -exports('ProgressStart', MSK.Progressbar) -- Support for old Scripts -RegisterNetEvent("msk_core:progressbar", MSK.Progressbar) - -MSK.ProgressStop = function() - SendNUIMessage({ - action = 'progressBarStop', - }) -end -exports('ProgressStop', MSK.ProgressStop) -RegisterNetEvent("msk_core:progressbarStop", MSK.ProgressStop) - MSK.LoadAnimDict = function(dict) assert(dict and DoesAnimDictExist(dict), 'Parameter "dict" is nil or the AnimDict does not exist') diff --git a/client/functions/numpad.lua b/client/functions/numpad.lua index 9990853..0013d5d 100644 --- a/client/functions/numpad.lua +++ b/client/functions/numpad.lua @@ -55,6 +55,11 @@ MSK.Register('msk_core:numpad', function(source, pin, show) return MSK.Numpad.Open(pin, show) end) +MSK.Numpad.Active = function() + return isNumpadOpen +end +exports('NumpadActive', MSK.Numpad.Active) + RegisterNUICallback('submitNumpad', function(data) callback(true) MSK.Numpad.Close() diff --git a/client/functions/progressbar.lua b/client/functions/progressbar.lua new file mode 100644 index 0000000..b454fc3 --- /dev/null +++ b/client/functions/progressbar.lua @@ -0,0 +1,41 @@ +MSK.Progress = {} + +local isProgressOpen = false + +MSK.Progress.Start = function(time, text, color) + if isProgressOpen then + MSK.Progress.Stop() + end + isProgressOpen = true + + SendNUIMessage({ + action = 'progressBarStart', + time = time, + text = text or '', + color = color or Config.progressColor, + }) + + SetTimeout(time, function() + isProgressOpen = false + end) +end +MSK.Progressbar = MSK.Progress.Start -- Support for old Scripts +exports('Progressbar', MSK.Progress.Start) +exports('ProgressbarStart', MSK.Progress.Start) -- Support for old Scripts +RegisterNetEvent("msk_core:progressbar", MSK.Progress.Start) + +MSK.Progress.Stop = function() + SendNUIMessage({ + action = 'progressBarStop', + }) + + isProgressOpen = false +end +MSK.ProgressStop = MSK.Progress.Stop -- Support for old Scripts +exports('ProgressStop', MSK.Progress.Stop) -- Support for old Scripts +RegisterNetEvent("msk_core:progressbarStop", MSK.Progress.Stop) + +MSK.Progress.Active = function() + return isProgressOpen +end +exports('ProgressActive', MSK.Progress.Active) \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua index d8889ff..bb68b12 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ games { 'gta5' } author 'Musiker15 - MSK Scripts' name 'msk_core' description 'Functions for MSK Scripts' -version '2.4.7' +version '2.4.8' lua54 'yes'