Supported by CRC
Spawn a pedestrian preview of a character based on the Appearance
interface.
-
Create a folder in your
src
folder calledcrc-preview-character
. -
Add the
TypeScript
files from this resource, to that folder. -
Modify
server.toml
and ensure it loads whatever you named the folder.
In the case of the example above it should be crc-preview-character
.
resources = [
'crc-db',
'crc-native-menu',
'crc-instructional-buttons',
'crc-discord-login',
'crc-preview-character'
'watch-resources'
]
Your resource structure may vary
When you create a ped preview you also have to supply a position for the pedestrian to be spawned at.
Emit this when you want to create a ped, and apply appearance to that ped.
alt.emit('crc-preview-character-update', someAppearanceData, somePosition);
Listen to this event to see when a peds appearance has been changed
alt.on('crc-preview-character-updated', (somePed) => {});
Emit this when you want to destroy the created ped.
alt.emit('crc-preview-character-destroy');
Listen to this even when you want to know when the preview was destroyed
alt.on('crc-preview-character-destroyed', () => {});