Jump to content

Progress Bar u prohledavaní


Freezysek

Recommended Posts

Zdravím koukal sem že dost lidí schaní při prohledavaní progressbar nebo animaci. 😄

Potřebujete: Ox_lib / Ox_inventory

1. Krok
otevřeme si ox_inventory/client.lua nasledně si najdeme openNearbyInventory (pokud nemate upravovaný client, bývá to na řádku 542)

local function openNearbyInventory()

2. Krok
Vložíme tento source pod local který vidíte v kroku 1. (source by měl začínat pod local function openNearbyInventory() končit před exports('openNearbyInventory', openNearbyInventory) )

    if canOpenInventory() then
        local targetId, targetPed = Utils.GetClosestPlayer()

        if targetId and (client.hasGroup(shared.police) or canOpenTarget(targetPed)) then
            Utils.PlayAnim(1000, 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@', 'machinic_loop_mechandplayer', 1.0, 1.0, -1, 50, 0.0, 0, 0, 0)
            exports.ox_inventory:Progress({
                duration = 1000,
                label = 'Prohledáváš osobu',
                useWhileDead = false,
                canCancel = false,
                disable = {
                    move = true,
                    car = true,
                    combat = true,
                    mouse = false
                },
       
            }, function(cancel)
               
            end)
            Utils.PlayAnim(2000, 'mp_common', 'givetake1_a', 1.0, 1.0, -1, 50, 0.0, 0, 0, 0)
            client.openInventory('player', GetPlayerServerId(targetId))
        end
    end
end'


3. Krok (konečná verze)
Celý source by měl vypadat takto: (nasledně si mužete měnit time prohlevaní nebo animace)

 

local function openNearbyInventory()
	if canOpenInventory() then
		local targetId, targetPed = Utils.GetClosestPlayer()

		if targetId and (client.hasGroup(shared.police) or canOpenTarget(targetPed)) then
			Utils.PlayAnim(1000, 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@', 'machinic_loop_mechandplayer', 1.0, 1.0, -1, 50, 0.0, 0, 0, 0)
			exports.ox_inventory:Progress({
				duration = 1000,
				label = 'Prohledáváš osobu',
				useWhileDead = false,
				canCancel = false,
				disable = {
					move = true,
					car = true,
					combat = true,
					mouse = false
				},
		
			}, function(cancel)
			   
			end)
			Utils.PlayAnim(2000, 'mp_common', 'givetake1_a', 1.0, 1.0, -1, 50, 0.0, 0, 0, 0)
			client.openInventory('player', GetPlayerServerId(targetId))
		end
	end
end
exports('openNearbyInventory', openNearbyInventory)
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...