Editable Client Side
x
function UseSkillBar(skillLevels, fixLaikas) if not Config.SkillBar then return true -- Bypass skill bar if disabled end local success = false if Config.SkillBarType == 'ox' then success = lib.skillCheck(skillLevels, {'e'}) elseif Config.SkillBarType == 'qb' then local Skillbar = exports['qb-skillbar']:GetSkillbarObject() Skillbar.Start({ duration = fixLaikas / 3, pos = math.random(10, 30), width = math.random(10, 20), }, function() success = true end, function() success = false end) elseif Config.SkillBarType == 'custom' then -- Add your custom skill bar logic here -- Set `success` to true or false based on the custom logic print("Implement Custom Skillcheck Bar Logic") end return successendfunction UseProgressBar(duration, text) if not Config.ProgressBar then Citizen.Wait(duration) return true -- Simulate progress bar completion if disabled end local completed = false if Config.ProgressBarType == 'ox' then completed = lib.progressCircle({ duration = duration, position = 'bottom', useWhileDead = false, canCancel = true, disable = { car = true, move = false, combat = true, }, anim = { dict = 'mp_arresting', clip = 'a_uncuff' }, }) elseif Config.ProgressBarType == 'qb' then local QBCore = exports['qb-core']:GetCoreObject() loadAnimDict('mp_arresting') TaskPlayAnim(GetPlayerPed(-1), 'mp_arresting', 'a_uncuff', 5.0, 1.0, 1.0, 48, 0.0, 0, 0, 0) QBCore.Functions.Progressbar('Changeme', text, duration, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true }, {}, {}, {}, function() completed = true end, function() completed = false end) elseif Config.ProgressBarType == 'custom' then print("Implement Custom Progress Bar Logic") end return completedend-- What happens after weapon is jammedfunction WeaponJammedNotify() Notify(Config.Text['weapon_jammed'])end-- Function that handles weapon jammingfunction cleaning() UPDATEGLOBAL_IsScriptRunning(false) if GETGLOBAL_cleaningInProgress() then return end UPDATEGLOBAL_cleaningInProgress(true) local player = GetPlayerPed(-1) local weapon = GetSelectedPedWeapon(player) local randomSK = math.random(1, 3) local success = false if Config.InteractSound then TriggerServerEvent('InteractSound_SV:PlayOnSource', 'unjamming', Config.ISVolumeJam) end -- Configure skill levels and durations based on randomSK local skillLevels, strigimas, labelText if randomSK == 1 then skillLevels = Config.JamType1SkillLevels or {'easy', 'easy', 'easy'} strigimas = math.random(Config.JamType1Min, Config.JamType1Max) labelText = Config.Text['weapon_jammed1'] elseif randomSK == 2 then skillLevels = Config.JamType2SkillLevels or {'easy', 'easy', 'easy'} strigimas = math.random(Config.JamType2Min, Config.JamType2Max) labelText = Config.Text['weapon_jammed2'] elseif randomSK == 3 then skillLevels = Config.JamType3SkillLevels or {'easy', 'easy', 'easy'} strigimas = math.random(Config.JamType3Min, Config.JamType3Max) labelText = Config.Text['weapon_jammed3'] end -- Execute skill bar success = UseSkillBar(skillLevels, strigimas) if success then success = UseProgressBar(strigimas, labelText) end -- Finalize cleaning if success then ClearPedTasks(player) FixWeapon() end UPDATEGLOBAL_cleaningInProgress(false) UPDATEGLOBAL_IsScriptRunning(true)end-- KitType [string]: g_valymo_rink_pro or g_valymo_rink-- Oil [number]-- Phyton [number]-- CleaningTime [number] (time in ms)-- Durability [number]function CustomCleaningFunction(KitType, Oil, Phyton, CleaningTime, Durability) if not Config.UseCustomCleaningFunction then return end -- Example code: local totalTime = CleaningTime if KitType == 'g_valymo_rink_pro' then totalTime = totalTime - Config.RemoveTimeProKit end if Oil >= 1 then totalTime = totalTime - Config.RemoveTimeOil end if Phyton >= 1 then totalTime = totalTime - Config.RemoveTimePhyton end -- Handling sounds if Config.CleaningSounds and Config.InteractSound then local soundType if totalTime > 30000 then soundType = '30s' elseif totalTime >= 20000 then soundType = '20s' else soundType = '10s' end TriggerServerEvent('InteractSound_SV:PlayOnSource', soundType, Config.ISVolumeCleaning) end Notify('Custom cleaning started!') if Config.Inventory == 'qb' then TriggerServerEvent('Domas:ValauGinklaQB', 100) elseif Config.Inventory == 'ox' then TriggerServerEvent('Domas:ValauGinkla', 100) end -- Keep in mind, this function does not use any of the minigames, and will always give 100% of the durability, feel free to code in the logicendWas this page helpful?