Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Persistent
- Menu, Tray, NoStandard
- Menu, Standard, Standard
- Menu, Tray, Add, Add a User, AddGTAUser
- Menu, Tray, Add, Standard Stuff, :Standard
- IniRead, GTAUsernameNum, GTAUsers.ini, Numbers, GTAUsernames, 0
- If GTAUsernameNum < 1
- {
- MsgBox, 4, Auto Script Starter, There are currently no users listed, would you like to add a user?
- IfMsgBox Yes
- {
- Gosub, AddGTAUser
- }
- }
- SetTimer, AutoScriptLooper, 0
- SetTimer, AutoScriptLooper, On
- Return
- AddGTAUser:
- InputBox, GTAUsername,, Please enter the name of this user.
- If ErrorLevel
- Return
- FileSelectFile, SelectedFile, 3, %A_Desktop%, Please select a new script to add to the automatic script launcher.
- If ErrorLevel
- Return
- SplitPath, SelectedFile, Script, ScriptPath
- IniRead, Num, GTAUsers.ini, Numbers, GTAUsernames, 0
- Num+=1
- IniWrite, %Num%, GTAUsers.ini, Numbers, GTAUsernames
- InIWrite, %GTAUsername%, GTAUsers.ini, GTAUsernames, %Num%
- InIWrite, %ScriptPath%, GTAUsers.ini, GTAScriptDirs, %Num%
- InIWrite, %Script%, GTAUsers.ini, GTAScripts, %Num%
- MsgBox, 64, Success!, Done!`n`nUsername:`n%GTAUsername%`n`nPath:`n%ScriptPath%`n`nExecutable:`n%Script%
- Return
- AutoScriptLooper:
- Process, Exist, gta_sa.exe
- If ErrorLevel
- {
- Loop,
- {
- FileReadLine, RandomVar, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, %A_Index%
- If ErrorLevel
- {
- LineNum:=A_Index-2
- Break
- }
- }
- FileReadLine, RT, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, %LineNum%
- If LineNum > 48
- {
- FileMove, %a_mydocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, ES Chatlogs\Too Long - %A_Now%.txt
- }
- IniRead, GTAUsernameNum, GTAUsers.ini, Numbers, GTAUsernames, 0
- Loop, %GTAUsernameNum%
- {
- IniRead, GTAUsername, GTAUsers.ini, GTAUsernames, %A_Index%
- IfInString, RT, %GTAUsername%
- {
- IniRead, GTAScriptDir, GTAUsers.ini, GTAScriptDirs, %A_Index%
- IniRead, GTAScript, GTAUsers.ini, GTAScripts, %A_Index%
- SetWorkingDir, %GTAScriptDir%
- Run, %GTAScript%
- SetWorkingDir, %CurrentDir%
- Suspend, On
- Process, WaitClose, gta_sa.exe
- Suspend, Off
- Reload
- }
- }
- }
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement