Mugshot to all players on OneSync?

Hi!

How would you go about generating and sending mugshots to all players on the server?

image

I handled client sided generation the way I want to, but I’m unsure how to send it over to players on the other side of the map, whose clients can not see the person in question.

Is anyone willing to share a solution?

Here’s a general outline of how I would probably do it

On initial load & ped model change upload the screen pedshot to an image server that keeps an image on the players unique id

Ignore some of the redundancy here, this was when i was testing different natives

    const plyUid = "some unique identifier per player character"
	const ped = PlayerPedId();

	const registerFn = RegisterPedheadshotTransparent;

	let pedShot = registerFn(ped!);
	const abortAt = GetGameTimer() + 100;

	while (!IsPedheadshotReady(pedShot)) {
		const gt = GetGameTimer();
		if (gt > abortAt) {
			UnregisterPedheadshot(pedShot);
			return false;
		}
		await Delay(0);
	}

	const txd: string = GetPedheadshotTxdString(pedShot);

	await nuiHandler.sendNUIMessage({
		method: "RegisterHeadshot",
		data: {
			plyUid,
			txd
		}
	});

	UnregisterPedheadshot(pedShot);

in the ui

	useNuiEvent("test-resource", "RegisterHeadshot", async ({ plyUid, txd }: { plyUid: number, txd: string; }) => {
		const imgFetch = await fetch(`https://nui-img/${txd}/${txd}`);
		const imgBlob = await imgFetch.blob();

		// send to a server image endpoint or route back to the server

	});

You can use runtime textures to draw it in the original ui, but I’m not sure how well it would work.

If you are already storing the ped’s appearance server side, you could technically just send that to every client to generate a new mugshot by simply spawning a client side ped and setting all the components… Probably not really that efficient, but it would work.

Would still be relatively more simple then my solution, you would just have longer ped mugshot loading.

I was hoping for some slightly more ellegant solution, but since GTA:O was not build with culling players in mind, I guess it complicates this exact type of things.

I guess I’ll then grab ped model and regenerate it on the end client for mugshot generation.