Jump to content

teaDecode return


Overkillz

Recommended Posts

Hello guys, well, my question is simple.

Im saving a file on the client folder and it is teaEncoded. Well, this fille can be modified by the user writing on it ...etc However, I want to prevent this while it is read. My idea is to get the bool value using teaDecode. However, Im always getting that the file is Ok even if it is modified by the user (In this case me) Im not sure if you understand me.

Here is my code

function loadMapFromCache(wha)
	if wha then
		local pathMap = tostring("asd/dsa/"..wha..".wah")
		if fileExists(pathMap) then
			file = fileOpen(pathMap) 
			if file then 
				local fileR = fileRead(file, fileGetSize(file))
				fileR = teaDecode( fileR, temporalTeaCode )
				fileClose(file)
				if fileR then
					outputChatBox("Is Ok")
				else
					outputChatBox("Is wrong")
				end
			end 
		end
	end
end

 

Link to comment
  • Moderators

teaDecode will decode everything. Just it is looks like it is messed up if you changed it before decoding.

  • The easiest way is to compare fileR with the original file.
  • Or compare the file size.
Edited by IIYAMA
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...