RegisterNetEvent("inventory:client:OpenInventory")
AddEventHandler("inventory:client:OpenInventory", function(PlayerAmmo, inventory, other)
    if not check then
        if not IsEntityDead(GetPlayerPed(-1)) then
            ToggleHotbar(false)
            SetNuiFocus(true, true)
            if other ~= nil then
                currentOtherInventory = other.name
            end
            SendNUIMessage({
                action = "open",
                inventory = inventory,
                slots = MaxInventorySlots,
                other = other,
                maxweight = ESX.GetPlayerData().maxWeight,
                Ammo = PlayerAmmo,
                maxammo = Config.MaximumAmmoValues,
            })
            inInventory = true
        end
    end
end)