[Dev-Resource] Mythic Progress Bar

Did you add the calls in the callback function to add it? Did you add the animation flags in the event call?

how to add animation to use medikit or bandage ?

https://github.com/mythicrp/progressbar

Scroll down to animations on the readme.

i dont understand what you mean. but i do like this

RegisterServerEvent('esx_drugs:processCannabis')
AddEventHandler('esx_drugs:processCannabis', function()
	if not playersProcessingCannabis[source] then
		local _source = source

		playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing, function()
			local xPlayer = ESX.GetPlayerFromId(_source)
			local xCannabis, xMarijuana = xPlayer.getInventoryItem('cannabis'), xPlayer.getInventoryItem('marijuana')

			if xMarijuana.limit ~= -1 and (xMarijuana.count + 1) >= xMarijuana.limit then
				TriggerClientEvent('esx:showNotification', _source, _U('weed_processingfull'))
			elseif xCannabis.count < 3 then
				TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough'))
			else
				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

			playersProcessingCannabis[_source] = nil
		end)
	else
		print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1]))
	end
end)

Because you have to put the actions you want to be done if the action is done without cancelling in the callback function.

If you don’t know what that means, I mean not to be mean but should go work on basics. Not here to implement stuff for people.

im already do that. when the action not cancel giave item to player. but no animation and no processbar. that why i dont know what happen. the one post there is a simple. not the one i do in my server

RegisterServerEvent('esx_drugs:processCannabis')
AddEventHandler('esx_drugs:processCannabis', function()
	if not playersProcessingCannabis[source] then
		local _source = source

		playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing, function()
			local xPlayer = ESX.GetPlayerFromId(_source)
			local xCannabis, xMarijuana = xPlayer.getInventoryItem('cannabis'), xPlayer.getInventoryItem('marijuana')

			if xMarijuana.limit ~= -1 and (xMarijuana.count + 1) >= xMarijuana.limit then
				TriggerClientEvent('esx:showNotification', _source, _U('weed_processingfull'))
			elseif xCannabis.count < 3 then
				TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough'))
			else
				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
            xPlayer.removeInventoryItem('cannabis', 3)		
	xPlayer.addInventoryItem('marijuana', 1)
        end
    end)
			end

			playersProcessingCannabis[_source] = nil
		end)
	else
		print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1]))
	end
end)

this is what i do… no error but no animation no process bar and no give item

I must hit everytime i join the server the delete button to unstuck my player! Can you help me?

disableMovement = false,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,

Change disablemovment from true to false and is gonna be ok i think

i dont think it help!

Make em all false and try it again…trust me…just make this simple think…

Ok let me try :smile:

Not working.

Did you rename the resource folder to mythic_progbar? There’s no errors in F8?

Something you added is causing that, as this will do nothing until you trigger the event.

no error. it work fine with another

not work for that thing. no animation no bar no item. that why i fucked

TriggerEvent(“mythic_progbar:client:progress”, {
name = “hijack”,
duration = 10000,
label = “Unlock Vehicle”,
useWhileDead = false,
canCancel = true,
controlDisables = {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
disableCombat = false,
},
This is an example from a server that i develop and works nice…

it work fine with client and without register event.

RegisterServerEvent('esx_drugs:processCannabis')
AddEventHandler('esx_drugs:processCannabis', function()
	if not playersProcessingCannabis[source] then
		local _source = source

		playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing, function()
			local xPlayer = ESX.GetPlayerFromId(_source)
			local xCannabis, xMarijuana = xPlayer.getInventoryItem('cannabis'), xPlayer.getInventoryItem('marijuana')

			if xMarijuana.limit ~= -1 and (xMarijuana.count + 1) >= xMarijuana.limit then
				TriggerClientEvent('esx:showNotification', _source, _U('weed_processingfull'))
			elseif xCannabis.count < 3 then
				TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough'))
			else
				TriggerEvent("mythic_progbar:client:progress", {
        name = "unique_action_name",
        duration = 10000,
        label = "working",
        useWhileDead = false,
        canCancel = true,
        controlDisables = {
            disableMovement = false,
            disableCarMovement = false,
            disableMouse = false,
            disableCombat = false,
        },
        animation = {
            animDict = "missheistdockssetup1clipboard@idle_a",
            anim = "idle_a",
        },
        prop = {
            model = "prop_paper_bag_small",
        }
    }, function(status)
        if not status then
            xPlayer.removeInventoryItem('cannabis', 3)		
	        xPlayer.addInventoryItem('marijuana', 1)
        end
    end)
			end

			playersProcessingCannabis[_source] = nil
		end)
	else
		print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1]))
	end
end)

you can check it

Pushed an update that adds exported functions aswell as new progress that have start events & every-tick events.

Will add documentation later, but if you want to use the exports you can do so now :

exports['mythic_progbar']:Progress( <action object & callback go here> ) 

and it’s all the same parameters as before

New events just take additional functions for whatever events you want. If you do ProgressWithStartEvent than the first function you pass will be executed at the start of the action and second function will execute at end of action as it did before. if you do ProgressWithTickEvent than the first function passed will execute every tick and the second will execute at action finish. And if you do ProgressWithStartAndTick the first function will execute at start of action, second will execute every tick, third will execute at action finish. All of these functions are checked if they’re nil so you shouldn’t have issues if you for some reason want to call them without passing a function

Can view the commit here