[Dev-Resource] Mythic Progress Bar

can you explain the new update?? any example

It’s rather self explanatory, they’re functions that will either be ran at the start of an action, or every tick during the progress of the action.

Don’t have any docs done yet, been busy. But here’s a snippet from my fuel script that uses start & tick. Ignore my framework calls, you should be able to understand what’s happening from it though.

Note: There are parts with props that is part of something I haven’t pushed to GitHub, it just allows you to better fine tune position & rotation of the prop spawned

exports['mythic_progbar']:ProgressWithStartAndTick({
    name = 'fueling_action',
    duration = timer,
    label = 'Refueling Vehicle',
    useWhileDead = false,
    canCancel = true,
    controlDisables = {
        disableMovement = true,
        disableCarMovement = true,
        disableMouse = false,
        disableCombat = true,
    },
    animation = {
        animDict = 'weapons@misc@jerrycan@',
        anim = 'fire',
        flags = 49,
    },
    prop = {
        model = 'prop_jerrycan_01a',
        bone = 60309,
        coords = { x = 0.0, y = 0.1, z = 0.5 },
        rotation = { x = 364.0, y = 180.0, z = 90.0 },
    }
}, function()
    isFueling = true
    TriggerEvent('mythic_fuel:client:StartFuelUpTick', isNearPump, ped, vehicle)
end, function()
    local vehicleCoords = GetOffsetFromEntityInWorldCoords(vehicle, 0, 0, 0.5)
    local vehicleCoords2 = GetOffsetFromEntityInWorldCoords(vehicle, 0, 0, 0.38)
    currentFuel = GetFuel(vehicle)

    if isNearPump then
        TriggerEvent('mythic_base:client:Print3DText', vehicleCoords, Config.Strings.CancelFuelingPump)
        TriggerEvent('mythic_base:client:Print3DText', vehicleCoords2, 'Cost: ~g~$' .. currentCost .. ' ~r~- ~s~Fuel: ~g~' .. math.ceil(currentFuel))
    else
        local pumpCoords = GetOffsetFromEntityInWorldCoords(isNearPump, 0, 0, 1.2)
        local pumpCoords2 = GetOffsetFromEntityInWorldCoords(isNearPump, 0, 0, 1.08)
        TriggerEvent('mythic_base:client:Print3DText', pumpCoords, Config.Strings.CancelFuelingJerryCan)
        TriggerEvent('mythic_base:client:Print3DText', pumpCoords2, 'Gas can: ~g~' .. Round(GetAmmoInPedWeapon(ped, 883325847) / 4500 * 100, 1) .. '% ~r~| ~s~Vehicle: ~g~' .. Round(currentFuel, 1) .. '%')
    end

    if IsControlJustReleased(0, 178) or DoesEntityExist(GetPedInVehicleSeat(vehicle, -1)) or (isNearPump and GetEntityHealth(isNearPump) <= 0) then
        isFueling = false
    end
end, function(status)
    if isNearPump then
        TriggerServerEvent('mythic_fuel:server:Pay', currentCost)
    end
    isFueling = false
end)

2 Likes

seem with this new update. i can fix my problem. let me test and feedback to you

Not sure, I’m only using the UI from that inventory the entire back-end I’ve rewritten.

But I believe it’s based on if the item has been registered as a usable item?

That lockpicking from the video is part of my engine script that I made

Anyone having it where it wont set isDoingAction back to false when done?

Thanks!! Awesome work

Not an issue I’ve ever had, is the progress bar working fine beyond that? Only thing I could think of is the NUI callback not working because of the resource name.

By default it needs to be mythic_progbar. If you want to change it, go into the app.js file and find the $.posts’s and change the address it’s posting to and set it to whatever resource name you set.

How can I change the color of the bar. Changed it in the CSS not showing in game. Am I missing something?

Change it in the app.js.

Due to cancelling turning the bar red, it’s handled in JavaScript

1 Like

Ah, Thanks for that.

Loving this script so far.
I was wondering if I could private message you about a script I’m having some serious trouble with. (Fixing it should be easy for you hopefully), can I do that?

Go for it

How did you set time delay in config

can you explain us how you fixed it cause i want to add the same to my server

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 = "Leczysz swoje rany",
	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 = "Poczułeś się dużo lepiej",
			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 the animation doesn’t stop & prop doesn’t get despawned, rename resource to mythic_progbar or change the addresses that the JavaScript is posting to

rename resource ?

The folder in your resources folder needs to be mythic_progbar

Hi All,

Can someone help please, what am I missing for this to work in esx_mechanicjob?

RegisterNetEvent(‘esx_mechanicjob:onFixkit’)
AddEventHandler(‘esx_mechanicjob:onFixkit’, function()
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)

if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
	local vehicle

	if IsPedInAnyVehicle(playerPed, false) then
		vehicle = GetVehiclePedIsIn(playerPed, false)
	else
		vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71)
	end
	
	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",
		},	

	if DoesEntityExist(vehicle) then
		
	

		TaskStartScenarioInPlace(playerPed, 'PROP_HUMAN_BUM_BIN', 0, true)
		Citizen.CreateThread(function()
			Citizen.Wait(10000)
			SetVehicleFixed(vehicle)
			SetVehicleDeformationFixed(vehicle)
			SetVehicleUndriveable(vehicle, false)
			ClearPedTasksImmediately(playerPed)
			ESX.ShowNotification(_U('veh_repaired'))
		end)
	end
end

end)

Bzerk,

After looking into the section of coding you are displaying, and the main client file. This is what I have come up with.

RegisterNetEvent('esx_mechanicjob:onFixkit')
AddEventHandler('esx_mechanicjob:onFixkit', function()
	local playerPed = PlayerPedId()
	local coords    = GetEntityCoords(playerPed)

	if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
		local vehicle

		if IsPedInAnyVehicle(playerPed, false) then
			vehicle = GetVehiclePedIsIn(playerPed, false)
		else
			vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71)
		end

		if DoesEntityExist(vehicle) then
			TaskStartScenarioInPlace(playerPed, 'PROP_HUMAN_BUM_BIN', 0, true)
			TriggerEvent("mythic_progbar:client:progress", {
					name = "repair_vehicle",
					duration = 20000,
					label = "Repairing Vehicle",
					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)
			Citizen.CreateThread(function()
				Citizen.Wait(20000)
				SetVehicleFixed(vehicle)
				SetVehicleDeformationFixed(vehicle)
				SetVehicleUndriveable(vehicle, false)
				ClearPedTasksImmediately(playerPed)
				exports['mythic_notify']:DoHudText('success', _U('veh_repaired'))
			end)
		end
	end
end)

Just make sure your “duration = 20000,” and the “Citizen.Wait(20000)” below the progbar implementation match, otherwise the event itself, and the progbar animation may end at different times.

There are about 6 places within the mechanic file you could use the progbar. This includes:

elseif data.current.value == ‘hijack_vehicle’ then
elseif data.current.value == ‘fix_vehicle’ then
elseif data.current.value == ‘clean_vehicle’ then

Those are the 3 mechanic job duties.
Then you have:

RegisterNetEvent(‘esx_mechanicjob:onHijack’)
RegisterNetEvent(‘esx_mechanicjob:onCarokit’)
RegisterNetEvent(‘esx_mechanicjob:onFixkit’)

Those 3 are used when other players use the objects created by the mechanic. Blowtorch, Fix Kit, and Car Kit. In reality, I would not place the progbar within the NetEvents as everyone will see them and the label you provide may not be the same for what the user is actually doing.

If you would like further assistance with this, you can contact me on Discord and I can assist you. Demo#1180

Thank you Demo, working now as intended,