TorNix~|nR Posted October 11, 2018 Share Posted October 11, 2018 I used this resource ( object_preview ), the ped is showed but when I save it on png, it saves but saves empty this is the resource on community https://community.multitheftauto.com/index.php?p=resources&s=details&id=11836 any help please? this is the code local x, y, z = getCameraMatrix() local sx, sy = guiGetSize(GUIEditor.staticimage[1], false) local skin = createPed(getElementModel(localPlayer), x, y, z) local view = exports.object_preview:createObjectPreview(skin, 0, 0, 200, 0, 0, sx, sy, false, false, true) exports.object_preview:saveRTToFile(view, "gui_skin.png") exports.object_preview:destroyObjectPreview(view) destroyElement(skin) guiStaticImageLoadImage(GUIEditor.staticimage[1], "gui_skin.png") Link to comment
TorNix~|nR Posted October 12, 2018 Author Share Posted October 12, 2018 is it that hard? any help please? Link to comment
JeViCo Posted October 13, 2018 Share Posted October 13, 2018 you can't create object preview and save it instantly. Creating preview takes a little amount of time so you'll always get an empty image. setTimer will solve your problem @TorNix~|nR 1 Link to comment
TorNix~|nR Posted October 14, 2018 Author Share Posted October 14, 2018 Thank you it's working, but when I open the panel, every 50 milliseconds the ped automatically disappear, this is the problem you can see the image, it appears and suddenly disappears every time I open the panel Code: local x, y, z = getCameraMatrix() local sx, sy = guiGetSize(GUIEditor.staticimage[1], false) local skin = createPed(getElementModel(localPlayer), x, y, z) local view = exports.object_preview:createObjectPreview(skin, 0, 0, 200, 0, 0, sx, sy, false, false, true) setTimer(function ( ) exports.object_preview:saveRTToFile(view, "gui_skin.png") guiStaticImageLoadImage(GUIEditor.staticimage[1], "gui_skin.png") exports.object_preview:destroyObjectPreview(view) destroyElement(skin) end, 50, 1) Image: Link to comment
JeViCo Posted October 14, 2018 Share Posted October 14, 2018 @TorNix~|nR you should add empty file server side with name "gui_skin.png" and add it to meta.xml with download="false" property or you'll get error on 7-th line @Ren_712 could you fix a problem above ? object_preview creates 2 objects on screen if second render target's value = true 1 Link to comment
Bence2004 Posted December 21, 2019 Share Posted December 21, 2019 (edited) how i use this, any weapon? Edited December 21, 2019 by Bence2004 Link to comment
TorNix~|nR Posted December 23, 2019 Author Share Posted December 23, 2019 @Bence2004, what do you mean? Link to comment
Bence2004 Posted December 23, 2019 Share Posted December 23, 2019 For example, I have 2 weapons at a time and I want to use different textures on both. Link to comment
BranD Posted March 19, 2022 Share Posted March 19, 2022 you can cache the element and check for a change so you don't have to wait for the timer Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now