[Dev-Resource] Mythic Progress Bar

No problem. Just be aware that I also use mythic_notify, so there is an export in there for the notification upon completion of repair. You may need to change that if you are still going to display notifications.

change

exports['mythic_notify']:DoHudText('success', _U('veh_repaired'))

to

ESX.ShowNotification(_U('veh_repaired'))

For the original ESX Notification

Curious to why you would not just do the stuff you want to do after the event finishes … in the finish callback which allows for checking if they cancelled it.

That code you can cancel the event instantly and wait 20 seconds and it’ll still work.

It’s not my coding. That is the stock coding from the person that created the script. They never incorporated anything into it for canceling. I’m not a coder at all for LUA, and I wouldn’t know where to start for canceling something like that. I just knew where to place the progress bar, so figured I’d help them out with the location of where it goes.

how to use. on use item

How to insert prop on player hand.

Sorry but how can I add it when I use item is that code good for reapirkit ?

TriggerEvent(“mythic_progbar:client:progress”, {
name = “Zestaw Naprawczy”,
duration = 10000,
label = “Naprawianie”,
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)

Any idea on how i can disable the default animation while using medkit and rather get the medkit in mythic_hospital that also comes up on the progbar?

Thank you, is the first the lockpick animation ?
Is the second hot-wire animation ?

Hello,
I try the Progbar, so install in my job system, that as soon as you press the E or X button presses the Progbar, but do not quite understand how to cancel the Progbar …

cool!. nice. :wink:

? When the progress bar is going, you can press delete to cancel it. Can change it in the client script if you want it to be something else.

If an action is cancelled, the callback will still be called but the parameter passed to it will be true so you can do anything you need to in the event of a cancelled action.

How can i add it to this ?

-- CLIENTSIDED

-- Registers a network event
RegisterNetEvent('EngineToggle:Engine')
RegisterNetEvent('EngineToggle:RPDamage')

local vehicles = {}; RPWorking = true

function notify(string)
    SetNotificationTextEntry("STRING")
    AddTextComponentString(string)
    DrawNotification(true, false)
end

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		if UseKey and ToggleKey then
			if IsControlJustReleased(1, ToggleKey) then
				TriggerEvent('EngineToggle:Engine')
			end
		end
		if GetSeatPedIsTryingToEnter(GetPlayerPed(-1)) == -1 and not table.contains(vehicles, GetVehiclePedIsTryingToEnter(GetPlayerPed(-1))) then
			table.insert(vehicles, {GetVehiclePedIsTryingToEnter(GetPlayerPed(-1)), IsVehicleEngineOn(GetVehiclePedIsTryingToEnter(GetPlayerPed(-1)))})
		elseif IsPedInAnyVehicle(GetPlayerPed(-1), false) and not table.contains(vehicles, GetVehiclePedIsIn(GetPlayerPed(-1), false)) then
			table.insert(vehicles, {GetVehiclePedIsIn(GetPlayerPed(-1), false), IsVehicleEngineOn(GetVehiclePedIsIn(GetPlayerPed(-1), false))})
		end
		for i, vehicle in ipairs(vehicles) do
			if DoesEntityExist(vehicle[1]) then
				if (GetPedInVehicleSeat(vehicle[1], -1) == GetPlayerPed(-1)) or IsVehicleSeatFree(vehicle[1], -1) then
					if RPWorking then
						SetVehicleEngineOn(vehicle[1], vehicle[2], true, false)
						SetVehicleJetEngineOn(vehicle[1], vehicle[2])
						if not IsPedInAnyVehicle(GetPlayerPed(-1), false) or (IsPedInAnyVehicle(GetPlayerPed(-1), false) and vehicle[1]~= GetVehiclePedIsIn(GetPlayerPed(-1), false)) then
							if IsThisModelAHeli(GetEntityModel(vehicle[1])) or IsThisModelAPlane(GetEntityModel(vehicle[1])) then
								if vehicle[2] then
									SetHeliBladesFullSpeed(vehicle[1])
								end
							end
						end
					end
				end
			else
				table.remove(vehicles, i)
			end
		end
	end
end)

AddEventHandler('EngineToggle:Engine', function()
	local veh
	local StateIndex
	for i, vehicle in ipairs(vehicles) do
		if vehicle[1] == GetVehiclePedIsIn(GetPlayerPed(-1), false) then
			veh = vehicle[1]
			StateIndex = i
		end
	end
	Citizen.Wait(1500)
	if IsPedInAnyVehicle(GetPlayerPed(-1), false) then 
		if (GetPedInVehicleSeat(veh, -1) == GetPlayerPed(-1)) then
			vehicles[StateIndex][2] = not GetIsVehicleEngineRunning(veh)
			if vehicles[StateIndex][2] then
				notify('~y~Silnik włączony!')
			else
				notify('~y~Silnik wyłączony!')
			end
		end 
    end 
end)

AddEventHandler('EngineToggle:RPDamage', function(State)
	RPWorking = State
end)

if OnAtEnter then
	Citizen.CreateThread(function()
		while true do
			Citizen.Wait(0)
			if GetSeatPedIsTryingToEnter(GetPlayerPed(-1)) == -1 then
				for i, vehicle in ipairs(vehicles) do
					if vehicle[1] == GetVehiclePedIsTryingToEnter(GetPlayerPed(-1)) and not vehicle[2] then
						Citizen.Wait(2000)
						vehicle[2] = true
						notify('~y~Silnik włączony!')
					end
				end
			end
		end
	end)
end

function table.contains(table, element)
  for _, value in pairs(table) do
    if value[1] == element then
      return true
    end
  end
  return false
end

I mean, a good place to start would be formatting the code so it’s actually readable.

Sorry but i do not how can i send you the code :confused:

bug use key Delete to Canceled. how to fix ?

Use code tags so it stays formatted?

Wha… what? Yes, pressing delete cancels the action. That’s not a bug?

Hello im having a problem with the bar, i run a VRP server and installed the bar with badgerbank robberies and it works but the process is done it does not stop the action and i cant use delete or anything to get out of it…i would like to know how to fix!? thank you.

Either make sure the resource is named mythic_progbar, or change the NUI callback addresses in the JavaScript file

how would i go about editing the java script file? or the callbacks? to what?

got it working. i do have another question tho if the cops show up how can they get out of the RP of it?