[Dev-Resource] Mythic Progress Bar

Is it possible to call a cancel callback without a button press? For example if a player enters area, progress bar starts. If they leave the area before it completes, it cancels the action?

Sorry, didn’t see this.

You can just trigger the mythic_progbar:client:cancel event and it would cancel it.

Though, I’ve never tested it trying to trigger it from outside of when an action is going so you may need to add a check to see if an event is active (aka if isDoingAction then)

I have a problem using this…

	
    TriggerEvent("mythic_progbar:client:progress", {
        name = "open_doors",
        duration = 10000,
        label = "Action Label",
        useWhileDead = false,
        canCancel = true,
        controlDisables = {
            disableMovement = true,
            disableCarMovement = true,
            disableMouse = false,
            disableCombat = true,
        }
    }, function(status)
        if not status then
            -- Do Something If Event Wasn't Cancelled
        end
    end)

and I get this error :

how to add this to server.lua?

What?

i mean if i add this to client.lua its work
but if i add this to server.lua it didn’t work

for i=1, #item, 1 do
			local itemQtty = 0
			if item[i].name ~= _U('delivery') then
				itemQtty = xPlayer.getInventoryItem(item[i].db_name).count
TriggerEvent("mythic_progbar:client:progress", {
    name = "unique_action_name",
    duration = 10000,
    label = "Action Label",
    useWhileDead = false,
    canCancel = true,
    controlDisables = {
        disableMovement = true,
        disableCarMovement = true,
        disableMouse = false,
        disableCombat = true,
    },
    animation = {
        animDict = "missheistdockssetup1clipboard@idle_a",
        anim = "idle_a",
    },
    prop = {
        model = "prop_paper_bag_small",
    }
}, function(status)
    if not status then
        -- Do Something If Event Wasn't Cancelled
    end
end)
			end

			local requiredItemQtty = 0
			if item[1].requires ~= "nothing" then
				requiredItemQtty = xPlayer.getInventoryItem(item[1].requires).count
			end

			if item[i].name ~= _U('delivery') and itemQtty >= item[i].max then
				--TriggerClientEvent('esx:showNotification', source, _U('max_limit', item[i].name))
				TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'error', text = ('Melebihi kapasitas!' .. item[i].name), length = 5000})
			elseif item[i].requires ~= "nothing" and requiredItemQtty <= 0 then
				--TriggerClientEvent('esx:showNotification', source, _U('not_enough', item[1].requires_name))
				TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'error', text = ('Jumlah tidak cukup!' .. item[1].requires_name), length = 5000})
			else
				if item[i].name ~= _U('delivery') then
					-- Chances to drop the item
					if item[i].drop == 100 then
						xPlayer.addInventoryItem(item[i].db_name, item[i].add)
					else
						local chanceToDrop = math.random(100)
						if chanceToDrop <= item[i].drop then
							xPlayer.addInventoryItem(item[i].db_name, item[i].add)
						end
					end
				else
					xPlayer.addMoney(item[i].price)
				end
			end
		end

Like that, can u help me?

you cant LOL

Right … because this isn’t server-sided? Why would you be calling a progress bar on the server?

If you’re wanting to trigger an action from the server, call it like you would any other client event (TriggerClientEvent passing whatever source you’re wanting to receive the action)

i just want to add animation when someone take delivery on esx_jobs :smile:
sorry for being dumb, still learning about this stuff lol

Anyone has the bar like in the screenshot ?
Mine is just red with a big rectangle

I fixed mythic_progbar/client/main.lua script error.

How to do this?
Join the server resource and find mythic_progbar/client/main.lua

Go to 217. Line and change “progress(action, cb)” for “Progress(action, cb)”

Open console and write this commands “restart mythic_progbar”

RegisterNetEvent("mythic_progbar:client:progress")
AddEventHandler("mythic_progbar:client:progress", function(action, cb)
    Progress(action, cb)
end)
1 Like

can anyone help me to implement this to esx_jobs?

I can’t seem to get this to work with esx_extra items, I tried using the previous post as an example but it just never seems to work, it still heals but completely voids the mythic part.

RegisterNetEvent('esx_extraitems:firstaidkit')
AddEventHandler('esx_extraitems:firstaidkit', function()
	local playerPed = GetPlayerPed(-1)
	local health = GetEntityHealth(playerPed)
	local max = GetEntityMaxHealth(playerPed)
	RegisterNetEvent('esx_extraitems:firstaidkit')
AddEventHandler('esx_extraitems:firstaidkit', function()
	local playerPed = GetPlayerPed(-1)
	local health = GetEntityHealth(playerPed)
	local max = GetEntityMaxHealth(playerPed)
	
	TriggerEvent("mythic_progbar:client:progress", {
		name = "medicbag",
		duration = 10000,
		label = "Bandaging your wounds...",
		useWhileDead = false,
		canCancel = true,
		controlDisables = {
				disableMovement = true,
				disableCarMovement = true,
				disableMouse = false,
				disableCombat = true,
		},
		animation = {
				animDict = "missheistdockssetup1clipboard@idle_a",
				anim = "idle_a",
		},
		prop = {
				model = "prop_ld_health_pack",
		}
	}, function(status)
		if not status then
			SetEntityHealth(playerPed, max)
			TriggerEvent("pNotify:SendNotification", {
				layout = "bottomRight",
				text = "You feel better.",
				type = "info",
				theme = "gta",
				sounds = {
					sources = {"notification.wav"}, -- For sounds to work, you place your sound in the html folder and then add it to the files array in the __resource.lua file.
					volume = 0.2,
					conditions = {"docVisible"} -- This means it will play the sound when the notification becomes visible.
				}
				})
		end
	end)
end)

	if health > 0 and health < max then
		ESX.ShowNotification(_U('use_firstaidkit'))
		
		health = health + (max / 4)
		if health > max then
			health = max
		end
		SetEntityHealth(playerPed, health)
	end
end)

-- End of First Aid Kit

is this style still possible instead of the plain red… ?
image

Please Help, I can’t seem to get mine to work, like this was a requirement for a Burglary script, but the bar won’t work for me for some reason, any suggestions on how to get this to work?

Some of the help needed :slight_smile:

  1. I still can’t move after changing ‘disableMovement=true’ etc
    Edit: Add ‘flags=49,’ after anim
  2. How do I cancel ‘ALL ACTIONS’ upon finishing the task? I think the issue is I modified to have loop animation within F3 and my animation doesn’t stop after completing.
    Edit: Answered my own question by adding ‘ClearPedTasksImmediately(playerPED)’
  3. Can we still using the orange/black instead of the BIG red/black?
    Edit: Can be changed in script.js

Rating this 2.5 stars bc it isen’t possible to use server sided

how to install ??
this prograss bar with hospital file resource

easy bruh, just add it at client main.lua, when its called zone.type ‘work’, add it.

guys i’m not a coder or developer can someone help me how to install this script i did everything that given in instructions but its not working. help me guys…