Does FiveM expose ingame assets like fonts or images to html?

I know I can access jquery built into FiveM like this:

<script src="nui://game/ui/jquery.js" type="text/javascript"></script>

Is it possible to access and embed fonts like ‘Sign Painter’ or images like heritage grayscale portrait and other assets that GTA uses in a similar way?

I’d like to access them without having to extract and include them with my resource separately, because:

  1. It sort of is duplication and a waste of storage (even if they are very small).

  2. There might be license-related issues while trying to distribute extracted assets. Most of them, if not all, are copyrighted.

I believe something like https://nui-img/txd/txn was added at some point. It’s not on cookbook however which is weird.

3 Likes

Any chance this is documented anywhere? Or at least has a single example of correct usage?

Or am I just dumb and this IS the example (txd being texture dir and txn texture name?)

yes, it is

I’ve tried textures from a list on a site that apparently I cannot link, since it has a “not allowed” word in it’s address.

in regular elements:

<img src="https://nui-img/mpawards5/missionscore">

or

<img src="https://nui-img/awards/missionscore">

and many others that are used with native calls in for example RageUI library:

<img src="https://nui-img/pause_menu_pages_char_mom_dad/mumdadbg">

But none of them worked, I get a placeholder for image when it’s invalid I think:
invalid_image

Does it have to be loaded first with RequestStreamedTextureDict or has any other prerequisites before it can be used? Maybe I just don’t have a valid texture list?

Any chance for more detailed instructions?

Yes, this is a requirement for anything relating to textures.

1 Like

It indeed does work, I am greatly impressed.

loaded

I think this belongs on cookbook, such great feature must be made widely known.