Jump to content

teaDecode return


Overkillz

Recommended Posts

Posted

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

 

  • Moderators
Posted (edited)

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
Posted

Yes, I was already aware about doing a trigger but I wanted to avoid that. Luckily I could do it checking if the files was successfully teaDecoded and checking if the variable is a table. Looks like it works pretty good and I don't need to trigger it.

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...