CoreyHUN Posted March 24, 2015 Share Posted March 24, 2015 Hey guys, does anybody know how to encode DFF files with teaEncode? Can someone write an exact example for it? Link to comment
HUNGRY:3 Posted March 24, 2015 Share Posted March 24, 2015 https://wiki.multitheftauto.com/wiki/TeaEncode Link to comment
CoreyHUN Posted March 24, 2015 Author Share Posted March 24, 2015 I couldn't even understand the wiki, i'm confused about it, it's hard to understand for me Link to comment
Addlibs Posted March 24, 2015 Share Posted March 24, 2015 thefile = fileOpen( < File > ) content = fileRead(thefile) encodedContent = teaEncode(content, < Key >) But I don't see why you would do that - sooner or later you will need to decode the file, save it, load it through engineLoadDFF and then maybe delete the decoded one. MTA currently doesn't support loading DFF files into buffer to create a 'DFF' element out of it. If you want to encode it into a standard base64 (without tiny encryption algorithm), then use base64Encode and base64Decode, but as said earlier, it's quite useless for DFF files. Link to comment
Gallardo9944 Posted March 24, 2015 Share Posted March 24, 2015 local info = "http://er-mta.net" local key = "somewordshere" local encrypted = teaEncode(info,key) outputChatBox(encrypted) -- will output hashed line, in this example: QfHxIWo2bp2J4rUr4rnPcboBG84R0KJ0 local decrypted = teaDecode(encrypted,key) -- decrypt with the same key outputChatBox(decrypted) -- will output "http://er-mta.net" That's the basic example. Encrypt it and then fileWrite. You can decrypt your file and use engineLoadDFF(decrypted) with that string you got. This way, you better use: function teaEncodeBinary( data, key ) return teaEncode( base64encode( data ), key ) end function teaDecodeBinary( data, key ) return base64decode( teaDecode( data, key ) ) end But I don't see why you would do that - sooner or later you will need to decode the file, save it, load it through engineLoadDFF and then maybe delete the decoded one. MTA currently doesn't support loading DFF files into buffer to create a 'DFF' element out of it. Not really. It supports raw data since 1.4.1 r7088 Link to comment
CoreyHUN Posted March 25, 2015 Author Share Posted March 25, 2015 So basically what you are saying is, I should load the DFF, encrypt then delete it then write a new file using the encrypted data? Link to comment
Addlibs Posted March 25, 2015 Share Posted March 25, 2015 Well.. You can do onClientResourceStart resourceRoot triggerServerEvent requestDFFs and the make the server read the file stored in the resource folder (not added to meta.xml, so that it won't be downloaded by the client), send it to the client (probably encoded, so that hackers cannot "pull" data from networking), decode it in the client, and load it into DFF form by raw data. 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