Advertisement
Doug4347

Automatic Script Starter (SAMP)

Oct 15th, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Persistent
  2. Menu, Tray, NoStandard
  3. Menu, Standard, Standard
  4. Menu, Tray, Add, Add a User, AddGTAUser
  5. Menu, Tray, Add, Standard Stuff, :Standard
  6. IniRead, GTAUsernameNum, GTAUsers.ini, Numbers, GTAUsernames, 0
  7. If GTAUsernameNum < 1
  8.     {
  9.         MsgBox, 4, Auto Script Starter, There are currently no users listed, would you like to add a user?
  10.         IfMsgBox Yes
  11.             {
  12.                 Gosub, AddGTAUser
  13.             }
  14.     }
  15. SetTimer, AutoScriptLooper, 0
  16. SetTimer, AutoScriptLooper, On
  17. Return
  18.  
  19. AddGTAUser:
  20. InputBox, GTAUsername,, Please enter the name of this user.
  21. If ErrorLevel
  22.  Return
  23. FileSelectFile, SelectedFile, 3, %A_Desktop%, Please select a new script to add to the automatic script launcher.
  24. If ErrorLevel
  25.  Return
  26. SplitPath, SelectedFile, Script, ScriptPath
  27. IniRead, Num, GTAUsers.ini, Numbers, GTAUsernames, 0
  28. Num+=1
  29. IniWrite, %Num%, GTAUsers.ini, Numbers, GTAUsernames
  30. InIWrite, %GTAUsername%, GTAUsers.ini, GTAUsernames, %Num%
  31. InIWrite, %ScriptPath%, GTAUsers.ini, GTAScriptDirs, %Num%
  32. InIWrite, %Script%, GTAUsers.ini, GTAScripts, %Num%
  33. MsgBox, 64, Success!, Done!`n`nUsername:`n%GTAUsername%`n`nPath:`n%ScriptPath%`n`nExecutable:`n%Script%
  34. Return
  35.  
  36. AutoScriptLooper:
  37.     Process, Exist, gta_sa.exe
  38.     If ErrorLevel
  39.     {
  40.         Loop,
  41.         {
  42.             FileReadLine, RandomVar, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, %A_Index%
  43.             If ErrorLevel
  44.             {
  45.                 LineNum:=A_Index-2
  46.                 Break
  47.             }
  48.         }
  49.         FileReadLine, RT, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, %LineNum%
  50.         If LineNum > 48
  51.         {
  52.             FileMove, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, ES Chatlogs\Too Long - %A_Now%.txt
  53.         }
  54.         IniRead, GTAUsernameNum, GTAUsers.ini, Numbers, GTAUsernames, 0
  55.         Loop, %GTAUsernameNum%
  56.         {
  57.             IniRead, GTAUsername, GTAUsers.ini, GTAUsernames, %A_Index%
  58.             IfInString, RT, %GTAUsername%
  59.             {
  60.                 IniRead, GTAScriptDir, GTAUsers.ini, GTAScriptDirs, %A_Index%
  61.                 IniRead, GTAScript, GTAUsers.ini, GTAScripts, %A_Index%
  62.                 SetWorkingDir, %GTAScriptDir%
  63.                 Run, %GTAScript%
  64.                 SetWorkingDir, %CurrentDir%
  65.                 Suspend, On
  66.                 Process, WaitClose, gta_sa.exe
  67.                 Suspend, Off
  68.                 Reload
  69.             }
  70.         }
  71.     }
  72. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement