Guest User

Shammy's SA-MP Chatlog Archiver

a guest
Jun 9th, 2013
1,821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Set the working directory to the SA-MP directory...
  2. sampdir:=A_MyDocuments . "\GTA San Andreas User Files\SAMP\"
  3. SetWorkingDir, %sampdir%
  4.  
  5. ; If we're working in the wrong directory (ie you can't find the
  6. ; SA-MP config file) then return an error and exit.
  7. IfNotExist, sa-mp.cfg
  8.   MsgBox, Error: Could not find SA-MP directory. Expected location: %sampdir%
  9. IfNotExist, sa-mp.cfg
  10.   return
  11.  
  12. Loop {
  13.   ; Wait until GTA:SA is launched by SA-MP.
  14.   WinWait GTA:SA:MP
  15.  
  16.   ; Generate the filename based on the time SA-MP is launched.
  17.   filename:="chatlog-" . A_YYYY . A_MM . A_DD . "-" . A_Hour . A_Min . A_Sec
  18.  
  19.   ; Now wait for it to close before continuing.
  20.   WinWaitClose GTA:SA:MP
  21.  
  22.   ; Copy the chatlog to the separate directory with the filename we generated earlier.
  23.   FileCopy, chatlog.txt, chatlogarchiver\%filename%.txt
  24.  
  25.   ; Check that the file was actually copied, and return the location if it worked. If not,
  26.   ; return a generic error because I can't be bothered to code in methods of working out
  27.   ; what went wrong.
  28.   IfExist, chatlogarchiver\%filename%.txt
  29.     MsgBox, Chatlog saved as %sampdir%\chatlogarchiver\%filename%.txt.
  30.   IfNotExist, chatlogarchiver\%filename%.txt
  31.     MsgBox, There was an error and your chatlog was NOT archived.
  32. }
  33.  
  34. return
Advertisement
Add Comment
Please, Sign In to add comment