Blinker. Posted March 30, 2015 Share Posted March 30, 2015 Hello , i was wondering how to make the image go to cache like lua files .. so people can't simply take images of their mta folder.. Thanks in advance. Link to comment
.:HyPeX:. Posted March 30, 2015 Share Posted March 30, 2015 Make them cache? Or just edit it with fileWrite functions, add some random character when stopping the script at the start of the image file, and remove it when loading, so it will be corrupted. Link to comment
Gallardo9944 Posted March 31, 2015 Share Posted March 31, 2015 You can fetchRemote your images every time. I don't think this is really suitable for players with low-new solutions. I'd suggest you to teaEncode the data after doing fetchRemote and flush it on disk. Then, if file exists, just read it and teaDecode it (don't forget it's binary) Link to comment
Moderators IIYAMA Posted March 31, 2015 Moderators Share Posted March 31, 2015 Or when you are a starter in lua, convert them to textures and delete them. https://wiki.multitheftauto.com/wiki/DxCreateTexture Like this: local image = dxCreateTexture ( "filepath.png" ) fileDelete ("filepath.png") addEventHandler("onClientRender",root, function() dxDrawImage(0,0,1000,1000,image) end) Link to comment
RenanPG Posted April 1, 2015 Share Posted April 1, 2015 If it's not a heavy file, you can encrypt them using somehing like: https://wiki.multitheftauto.com/wiki/Base64Encode https://wiki.multitheftauto.com/wiki/Base64Decode addEventHandler('onClientResourceStart', resourceRoot, function() local img = fileOpen('img_encrypted.png') local pixels = base64Decode(fileRead(img, fileGetSize(img))) fileClose(img) local newImg = fileCreate("img.png") fileWrite(newImg, pixels) fileClose(newImg) image = dxCreateTexture("img.png") fileDelete("img.png") end) Link to comment
Blinker. Posted April 1, 2015 Author Share Posted April 1, 2015 i already did what gallardo said , thanks anyway Link to comment
3B00DG4MER Posted April 2, 2015 Share Posted April 2, 2015 Does changing file extension like .lua to .png or .png to .something does that MTA read it ? 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