Advertisement
Doug4347

MTG:RP/SAMP Payment Tracker

Nov 9th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Persistent
  2. OnExit, ExitScript
  3. Menu, Tray, NoStandard
  4. Menu, Standards, Standard
  5. Menu, Script, Add, Change Chatlog Dir (for when chatlogs get too long to read efficiently), NewTooLong
  6. Menu, Script, Add, Change Payment Log Dir, NewPaymentLog
  7. Menu, Tray, Add, Script Stuff, :Script
  8. Menu, Tray, Add, Standard Stuff, :Standards
  9. IniRead, TooLongDir, Settings.ini, Settings, TooLongDir
  10. IniRead, PaymentLog, Settings.ini, Settings, PaymentLog
  11. If TooLongDir = Error
  12.     {
  13.     RestartTooLogDir:
  14.         FileSelectFolder, TooLongDir,,, Please select a place to place all your chatlogs when they get too long.
  15.         If ErrorLevel
  16.             {
  17.                 MsgBox, You must have a directory selected!
  18.                 Goto, RestartTooLogDir
  19.             }
  20.         IniWrite, %TooLongDir%, Settings.ini, Settings, TooLongDir
  21.         MsgBox, New Dir:`n%TooLongDir%
  22.     }
  23. If PaymentLog = Error
  24.     {
  25.     RestartPaymentLog:
  26.         FileSelectFolder, PaymentLog,,, Please select a place to put your payment logs.
  27.         If ErrorLevel
  28.             {
  29.                 MsgBox, You must have a directory selected!
  30.                 Goto, RestartPaymentLog
  31.             }
  32.         IniWrite, %PaymentLog%, Settings.ini, Settings, PaymentLog
  33.         MsgBox, New Payment Log Dir:`n%TooLongDir%
  34.     }
  35. ;TooLongDir = TooLong\Too Long - %A_Now%
  36. ;PaymentLog = Payment Logs
  37. FileAppend, =============================`n[%A_Hour%:%A_Min%:%A_Sec%]Start At: 0`n, %PaymentLog%\Payments.txt
  38. SetTimer, PaymentLooper, On
  39. PaymentLooper:
  40.     Loop,
  41.         {
  42.             FileReadLine, RT, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, %A_Index%
  43.             If ErrorLevel
  44.             {
  45.                 LineNum:=A_Index-2
  46.                 Goto, PaymentStage2
  47.             }
  48.         }
  49. PaymentStage2:
  50.     FileReadLine, RT, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, %LineNum%
  51.     ; SplashImage,, x2000, %RT%
  52.     If LineNum > 98
  53.         {
  54.             FileCreateDir, %TooLongDir%
  55.             FileMove, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, %TooLongDir%\chatlog - %A_Now%.txt
  56.         }
  57.     IfInString, RT, You have been paid $
  58.         {
  59.             StringTrimLeft, Amount, RT, 31
  60.             StringGetPos, AmountPoint, Amount, %A_Space%
  61.             StringLen, Length, Amount
  62.             RightTrim:=Length-AmountPoint
  63.             StringTrimRight, Amount, Amount, %RightTrim%
  64.             If TotalAmount
  65.                 TotalAmount+=Amount
  66.             Else
  67.                 TotalAmount:=Amount
  68.             FileAppend, [%A_Hour%:%A_Min%:%A_Sec%]%TotalAmount%(+%Amount%)`n, %PaymentLog%\Payments.txt
  69.             FileAppend, ==AHK LINE==`n`n, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
  70.             SoundBeep
  71.             Sleep, 5000
  72.             Goto, PaymentLooper
  73.         }
  74. Return
  75. NewTooLong:
  76.     FileSelectFolder, TooLongDir,,, Please select a place to place all your chatlogs when they get too long.
  77.     If not ErrorLevel
  78.         {
  79.             IniWrite, %TooLongDir%, Settings.ini, Settings, TooLongDir
  80.             MsgBox, New Dir:`n%TooLongDir%
  81.         }
  82. Return
  83. NewPaymentLog:
  84.     FileSelectFolder, PaymentLog,,, Please select a place to put your payment logs.
  85.     If not ErrorLevel
  86.         {
  87.             IniWrite, %PaymentLog%, Settings.ini, Settings, PaymentLog
  88.             MsgBox, New Payment Log Dir:`n%TooLongDir%
  89.         }
  90. Return
  91. ExitScript:
  92.     FileAppend, [%A_Hour%:%A_Min%:%A_Sec%]Total: %TotalAmount%`n=============================`n, %PaymentLog%\Payments.txt
  93.     ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement