- Documentation
- Client functions
- setElementPreviewCacheKey
Function
setElementPreviewCacheKey
The next preview shot is also saved in the persistent preview store under the given key. The store stays after leaving the game, so next time you can show the image right away with getElementPreviewCache, without creating a preview. Saving applies to one shot; after it the key is cleared. An empty key turns saving off.
Syntax
bool setElementPreviewCacheKey(preview preview, string key)Arguments
previewpreview- The preview.
keystring- Key: letters, digits,
_and-, up to 64 characters.
Returns
true on success, false on a bad key or preview.
Example
local veh = createVehicle(411, 0, 0, -50)
local preview = createElementPreview(veh, 256, 256)
setElementPreviewCacheKey(preview, "salon_411")
Notes
Shared store. The preview store is one for all servers, so use keys with your resource name, e.g. "salon_411".
See also
getElementPreviewCacheReturns the path of a shot saved in the persistent preview store bysetElementPreviewCacheKey. Pass the path todxDrawImageordxCreateTexture. The shot stays between game sessions.createElementPreviewCreates a preview of an element (a vehicle, a player, a ped, an object, a model object) as an image fordxDrawImage, e.g. for a car shop or a wardrobe.falseas the target = the scene from the camera. By default the camera orbits the target so that it fits in the frame.