Dealman Posted January 27, 2014 Posted January 27, 2014 Working on getting some of my resources to write logs when a player does a specific action. So far I've accomplishes all I want, the only issue I have is that I can't seem to find a way to move the position to a new line. Thus it becomes a complete mess to read. Does anyone know how to make it write on a new line? It's a text file so I understand that it doesn't have any 'true lines'(or does it...?). I've tried \n, which doesn't do anything.
iPrestege Posted January 27, 2014 Posted January 27, 2014 Working on getting some of my resources to write logs when a player does a specific action. So far I've accomplishes all I want, the only issue I have is that I can't seem to find a way to move the position to a new line. Thus it becomes a complete mess to read.Does anyone know how to make it write on a new line? It's a text file so I understand that it doesn't have any 'true lines'(or does it...?). I've tried \n, which doesn't do anything. Check this out : https://forum.multitheftauto.com/viewtopic.php?f=91&t=53562 I hope it help . 1
tosfera Posted January 27, 2014 Posted January 27, 2014 I even tried to search Thanks mate If that doesn't work, you can also set the start of your new line at the end of your file by counting it. It's a dirty trick but I used it several times; function writeLog ( text ) if not ( fileExists ( "logs/logs.txt" ) ) then fileCreate ( "logs/logs.txt" ); end file = fileOpen ( "logs/logs.txt" ) if ( file ) then pos = fileGetSize( file ); newPos = fileSetPos ( file, pos ); writeFile = fileWrite ( file, text .."\n" ); if ( writeFile ) then fileClose ( file ); else outputDebugString ( "Error writing the logs." ); fileClose ( file ); return false; end end end
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