'LinKin Posted May 27, 2014 Share Posted May 27, 2014 Hello, Is there a way to check if the meta has been modified? Not only the resource information (which you can get by using getResourceInfo) but the whole meta file. Thanks Link to comment
Maurize Posted May 27, 2014 Share Posted May 27, 2014 Maybe this is a good information for you: https://wiki.multitheftauto.com/wiki/Meta.xml Otherwise the easiest way that I know is, to set a value in xml and modify it through script. Link to comment
'LinKin Posted May 28, 2014 Author Share Posted May 28, 2014 I do that with settings. But setting's names are defined in meta, therefore, if they are changed, the script will not recognize them. But it's not settings the only reason why I want to check if the meta.xml is modified. I want to check if a .lua file has been added/removed in meta also. .. I don't have a clear idea of how to 'solve' this.. Probably using fileWrite, etc... I'm not sure.. How to compare a file to another? Link to comment
DakiLLa Posted May 28, 2014 Share Posted May 28, 2014 How to compare a file to another? By checking their hashes, with md5 for example. Link to comment
'LinKin Posted May 28, 2014 Author Share Posted May 28, 2014 (edited) Yeah.. but how to implement this on MTA? I can generate the MD5 of the meta.xml and put it somewhere in the script, but then when the script starts how can I compare the meta.xml against the original meta's MD5 ? EDIT: Found this: https://wiki.multitheftauto.com/wiki/Md5 So hm yeah.. How can I get the meta.xml text as a string in order to turn it to MD5 and compare it with the original one? EDIT2: https://wiki.multitheftauto.com/wiki/FileRead But there's an argument (count: The number of bytes you wish to read.) .. Why in the example that argument is 500? I don't really understand it EDIT3:Ok, I am reading the whole meta.xml but how can I know which number to put in the 'count' argument? I arbitrarily put 100000 (It did read the whole meta.xml) using the returned value of fileGetSize didn't work. Edited May 28, 2014 by Guest Link to comment
xXMADEXx Posted May 28, 2014 Share Posted May 28, 2014 Use something like this local hash = md5 ( fileRead ( "meta.xml", fileGetSize( "meta.xml" ) ) ) 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