dima3367 Posted November 7, 2016 Share Posted November 7, 2016 (edited) Hello everyone! Me again. For your server doing exceptionally unique models of machines and facilities, but there are "good" people who brazenly steal them from the server is removed from the cache. Previously, I used protection when a DFF and TXD file encoded in any way LUAC and they can not be opened. Since a lot of models and objects (approximately 1300 MB), the server load became wildly and many players disappearing textures and were hovering. I know that there is a fairly simple way in which you can not open the file TXD. Tell me, how is it possible to do. I hope you understand what I mean. Thanks in advance and sorry for my bad english. Edited November 7, 2016 by dima3367 Link to comment
MIKI785 Posted November 7, 2016 Share Posted November 7, 2016 I dont quite fully understand you but i guess you want a way of 'protecting' your model files, right? In that case just encrypt them using teaEncode and then on the client decrypt them and pass the decrypted data to engineLoadDFF and so on.. Link to comment
dima3367 Posted November 7, 2016 Author Share Posted November 7, 2016 I not really understand how to use it Click Could you elaborate on this? Link to comment
MIKI785 Posted November 7, 2016 Share Posted November 7, 2016 Well you would get the contents of the .dff using fileRead and then pass that to teaEncode, teaEncode has 2 arguments, that is data to encrypt and a key. You choose whatever key you want, it's like a password. Then on the client you use the same key to decrypt the data. Do you understand? Im on a phone atm so i cant really write actual code. Link to comment
dima3367 Posted November 7, 2016 Author Share Posted November 7, 2016 I do not understand one, the server itself can open files in order that they could see the players? Link to comment
MIKI785 Posted November 8, 2016 Share Posted November 8, 2016 (edited) I don't know what you're saying but it would look something like this: Server: local file = fileOpen("file.dff") --Open the file you want local data = fileRead(file, fileGetSize(file)) --Get the data in it fileClose(file) --Don't need it anymore data = teaEncode(data, "secret") --Encrypt the data with the passkey "secret" if fileExists("protected/file.dff") then --Check if it's there already fileDelete("protected/file.dff") --If so, delete it end local newFile = fileCreate("protected/file.dff") --Create a new one in 'protected' directory (so the names don't collide) fileWrite(newFile, data) --Write the encrypted data fileClose(newFile) --Save & close You would have to restart the resource after the encryption so that the HTTP cache is updated and players download the new ecrypted versions. Client: local file = fileOpen("protected/file.dff") --open the encrypted file local data = fileRead(file, fileGetSize(file)) --Read the encrypted data fileClose(file) data = teaDecode(data, "secret") --Decrypt the data using the "secret" passkey local dff = engineLoadDFF(data) --Load the DFF data --Do your stuff here.. Now in meta: <meta> <!-- Your scripts and stuff --> <file src="protected/file.dff"> </meta> Don't put in the original files. And of course, if it's not just a single file then rework it into a loop, this is just an example. Edited November 8, 2016 by MIKI785 2 Link to comment
dima3367 Posted November 8, 2016 Author Share Posted November 8, 2016 It is perfectly. But you're mine I do not fully understand. I have models of cars are replaced. That is their DFF and TCD go to cash to the player. I need to make sure that they were in the cache, but as it were coded, what would they had not been able to edit programs. Here's how to replace a model Client: function replaceModel() txd = engineLoadTXD('file.txd',420) engineImportTXD(txd,420) dff = engineLoadDFF('file.dff',420) engineReplaceModel(dff,420) end addEventHandler ( 'onClientResourceStart', getResourceRootElement(getThisResource()), replaceModel) Link to comment
dima3367 Posted November 8, 2016 Author Share Posted November 8, 2016 What can you say about it? Link to comment
MIKI785 Posted November 9, 2016 Share Posted November 9, 2016 There's no need to use that resource, just use TEA, it will do the job. I think i've answered your question, that is how to protect files. You should try and experiment around yourself with what i gave you, if you expect me to post a full code here that you'll just copy and paste then you're wrong and you'll never learn. 1 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