Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_icon=C:\Users\Nick\Pictures\icons\Icon_384.ico
- #AutoIt3Wrapper_UseUpx=n
- #AutoIt3Wrapper_Res_Description=(c) Trooper
- #AutoIt3Wrapper_Res_Fileversion=1.1
- #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #NoTrayIcon
- #include <INet.au3>
- #include <Process.au3>
- #include <GUIConstantsEx.au3>
- #Include <Array.au3>
- Global $updatesite = "http://fcbolzplatz.fc.funpic.de/QLUpdate/gcs.version", $dlsource = "http://fcbolzplatz.fc.funpic.de/QLUpdate/gcs_eng.exe"
- Global $updateinfo = "http://fcbolzplatz.fc.funpic.de/QLUpdate/gcs.update.info", $version = "1.1", $mainfile = "http://fcbolzplatz.fc.funpic.de/GCS/datei.txt"
- Global $dir = @ScriptDir, $gui, $max
- Opt("OnExitFunc","OnAutoItExit")
- Opt("TrayAutoPause",0)
- Opt("TrayMenuMode",1)
- TraySetToolTip("Global Custom Skins" & @crlf & "Version " & $version & @crlf & "(C) Nicksoft")
- Global $trayexit = TrayCreateItem("Exit")
- If not FileExists("img.exe") Then
- MsgBox(16,"Error","Uncomplete Package of GCS")
- Exit
- EndIf
- FileDelete("GCS.db")
- FileDelete("follow.db")
- FileWrite("GCS.db",_INetGetSource($mainfile))
- If Not FileExists(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","Pfad") & "\gta_sa.exe") Then
- If FileExists("gta_sa.exe") Then
- RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","Pfad","REG_SZ",@Scriptdir)
- Else
- Do
- $dir = FileSelectFolder("Choose GTA SA Folder","")
- If @error Then Exit
- If Not FileExists($dir & "\gta_sa.exe") Then MsgBox(16,"Error","The chosen Folder doesn�t contain GTA San Andreas")
- If FileExists($dir & "\gta_sa.exe") Then ExitLoop
- Until 1=2
- RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","Pfad","REG_SZ",$dir)
- EndIf
- RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","","REG_SZ","(C) Trooper")
- Else
- $dir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","Pfad")
- EndIf
- check4update()
- If ProcessExists("gta_sa.exe") Then
- MsgBox(16,"Error","You have to start GCS before cocnnecting to a server !")
- Exit
- EndIf
- Sleep(500)
- Do
- Do
- $tmsg = TrayGetMsg()
- If $tmsg = $trayexit Then Exit
- If Not ProcessExists("samp.exe") Then Exit
- Until WinExists("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]") And WinGetTitle("[ACTIVE]") = "Server Properties - ( Just click ""Connect""! )"
- $serverip = ControlGetText("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]","","[CLASS:TEdit; INSTANCE:3]")
- #cs
- If StringInStr($serverip,"127.0.0.1") Then
- WinSetTitle("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]","","Server Properties [Localhost]")
- ContinueLoop
- EndIf
- If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip) = "Done" Then
- ContinueLoop
- ElseIf RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip) = "loaded" Then ;existiert und wurde geladen
- $id = Random(1,10000000000000000,1)
- ControlDisable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]", "", "[CLASS:TButton; INSTANCE:1]")
- ProgressOn("Global Custom Skins","Download gefunden","Models wiederherstellen",@DesktopWidth-325,@DesktopHeight-200)
- FileMove($dir & "\models\gta3.img",$dir & "\models\gta3.img.old." & $id)
- FileMove($dir & "\models\gta3.img." & Stringreplace($serverip,":","-"),$dir & "\models\gta3.img",1)
- ProgressOff()
- ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
- Sleep(750)
- ControlClick( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
- Sleep(10000)
- Do
- Sleep(3000)
- Until not ProcessExists("gta_sa.exe")
- ProgressOn("Global Custom Skins","Beenden","Wiederherstellen von alten Models",@DesktopWidth-325,@DesktopHeight-200)
- FileMove($dir & "\models\gta3.img" ,$dir & "\models\gta3.img." & Stringreplace($serverip,":","-"),1)
- FileMove($dir & "\models\gta3.img.old." & $id,$dir & "\models\gta3.img",1)
- ProgressOff()
- ContinueLoop
- ElseIf RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip) = "perma" Then
- ControlClick( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
- Sleep(10000)
- Do
- Sleep(3000)
- Until not ProcessExists("gta_sa.exe")
- ContinueLoop
- EndIf
- #ce
- ControlDisable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
- ProgressOn("Global Custom Skins","Apply Skins","Connect to Main-Server",@DesktopWidth-325,@DesktopHeight-200)
- $readextern = IniRead("GCS.db","DB",$serverip,"error")
- If $readextern = "error" Then
- ProgressOff()
- ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
- ; RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip,"REG_SZ","Done")
- FileDelete("follow.db")
- WinSetTitle("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]","","Server Properties [Not Found in DB]")
- ContinueLoop
- EndIf
- ProgressSet(0,"Connect to 3rd Party Database")
- FileWrite("follow.db",_INetGetSource($readextern))
- $status = IniRead("follow.db","Status","Status","down")
- If $status <> "up" Then
- ProgressOff()
- MsgBox(16,"Error","The requested Server is GCS registered, but the configure file doesn�t exists !")
- ; RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip,"REG_SZ","Done")
- ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
- FileDelete("follow.db")
- WinSetTitle("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]","","Server Properties [Error-1]")
- ContinueLoop
- EndIf
- $numberofdownloads = IniReadSection("follow.db","Downloads")
- If @error Then
- ProgressOff()
- MsgBox(16,"Error","The requested Server have an existing, but damaged configure file.")
- ; RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip,"REG_SZ","Done")
- ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
- FileDelete("follow.db")
- WinSetTitle("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]","","Server Properties [Error-2]")
- ContinueLoop
- EndIf
- ProgressSet(0,"Backup Models" & @crlf & "The copy progress isn�t shown," & @crlf & "please be patient !")
- $tvar = Stringreplace($serverip,":","-")
- If Not FileExists($dir & "\models\gta3.img.GCS") Then FileCopy($dir & "\models\gta3.img", $dir & "\models\gta3.img.GCS")
- $editimg = $dir & "\models\gta3.img.GCS"
- ProgressOff()
- DirCreate(@ScriptDir & "\restore")
- Global $max = $numberofdownloads[0][0]
- $tlabel = load(1)
- loadperc1(0,$tlabel)
- ShellExecute("img.exe","","","open",@SW_HIDE)
- Do
- Sleep(250)
- Until ProcessExists("img.exe")
- Sleep(1000)
- $ttitle = WinGetTitle("")
- If WinExists("[TITLE:" & $ttitle & ";CLASS:ConsoleWindowClass]") Then
- $title = "[TITLE:" & $ttitle & ";CLASS:ConsoleWindowClass]"
- Else
- $title = "[CLASS:ConsoleWindowClass]"
- Do
- ProcessClose("cmd.exe")
- Until not ProcessExists("cmd.exe")
- EndIf
- ControlSend($title,"","","-open """ & $editimg & """{ENTER}")
- For $loop = 1 To $numberofdownloads[0][0]
- $dllink = IniRead("follow.db","Downloads",$loop,"error")
- If $dllink = "error" Then ContinueLoop
- ;ProgressSet(($loop / $numberofdownloads[0][0]) * 100,"Downloade " & $dllink)
- loadperc1($loop,$tlabel)
- $split = StringSplit($dllink,"/")
- $dateiname = $split[$split[0]]
- FileDelete(@ScriptDir & "\" & $dateiname)
- InetGet($dllink,@ScriptDir & "\" & $dateiname,1)
- Sleep(500)
- ;ProgressSet(($loop / $numberofdownloads[0][0]) * 100,"Integriere " & $dllink)
- Sleep(250)
- ControlFocus($title,"","")
- ControlSend($title,"","","-export """ & $dateiname & """ """ & @ScriptDir & "\restore"" {ENTER}")
- Sleep(250)
- ControlFocus($title,"","")
- ControlSend($title,"","","-import """ & @ScriptDir & "\" & $dateiname & """{ENTER}")
- Sleep(250)
- FileDelete($dateiname)
- Next
- Sleep(250)
- ControlSend($title,"","","-save {ENTER}")
- Sleep(250)
- ControlSend($title,"","","-close {ENTER}")
- Sleep(500)
- load(0)
- Do
- ProcessClose("img.exe")
- Until Not ProcessExists("img.exe")
- FileDelete("follow.db")
- $id = Random(1,10000000000000000,1)
- ProgressSet(0,"Benutze Modelset")
- FileMove($dir & "\models\gta3.img",$dir & "\models\gta3.img.old",1)
- FileMove($dir & "\models\gta3.img.GCS",$dir & "\models\gta3.img",1)
- ; RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip,"REG_SZ","loaded")
- ; ProgressOff()
- ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]", "", "[CLASS:TButton; INSTANCE:1]")
- Sleep(750)
- ControlClick( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]", "", "[CLASS:TButton; INSTANCE:1]")
- Sleep(10000)
- Do
- Sleep(2000)
- Until not ProcessExists("gta_sa.exe")
- WinSetState("[CLASS:TfmMain]","",@SW_DISABLE)
- ; ProgressOn("Global Custom Skins","Beenden","Wiederherstellen von alten Models",@DesktopWidth-325,@DesktopHeight-200)
- FileMove($dir & "\models\gta3.img" ,$dir & "\models\gta3.img.GCS",1)
- FileMove($dir & "\models\gta3.img.old",$dir & "\models\gta3.img",1)
- $tlabel = load(1)
- loadperc2($tlabel)
- ShellExecute("img.exe","","","open",@SW_HIDE)
- Do
- Sleep(250)
- Until ProcessExists("img.exe")
- Sleep(1000)
- $ttitle = WinGetTitle("")
- If WinExists("[TITLE:" & $ttitle & ";CLASS:ConsoleWindowClass]") Then
- $title = "[TITLE:" & $ttitle & ";CLASS:ConsoleWindowClass]"
- Else
- $title = "[CLASS:ConsoleWindowClass]"
- Do
- ProcessClose("cmd.exe")
- Until not ProcessExists("cmd.exe")
- EndIf
- ControlSend($title,"","","-open """ & $editimg & """{ENTER}")
- Sleep(250)
- $resetdff = FileFindFirstFile(@ScriptDir & "\restore\*.dff")
- Do
- $dffreset = FileFindNextFile($resetdff)
- If @error Then ExitLoop
- ControlFocus($title,"","")
- ControlSend($title,"","","-import """ & @ScriptDir & "\restore\" & $dffreset & """ {ENTER}")
- Sleep(250)
- Until 1=2 ;bis abbruch
- $resettxd = FileFindFirstFile(@ScriptDir & "\restore\*.txd")
- Do
- $txdreset = FileFindNextFile($resettxd)
- If @error Then ExitLoop
- ControlFocus($title,"","")
- ControlSend($title,"","","-import """ & @ScriptDir & "\restore\" & $txdreset & """ {ENTER}")
- Sleep(250)
- Until 1=2 ;bis abbruch
- Sleep(250)
- ControlFocus($title,"","")
- ControlSend($title,"","","-save {ENTER}")
- Sleep(250)
- ControlFocus($title,"","")
- ControlSend($title,"","","-close {ENTER}")
- Sleep(500)
- load(0)
- Do
- ProcessClose("img.exe")
- Until Not ProcessExists("img.exe")
- FileDelete(@scriptdir & "\restore\*.txd")
- FileDelete(@scriptdir & "\restore\*.dff")
- WinSetState("[CLASS:TfmMain]","",@SW_ENABLE)
- ; ProgressOff()
- Until 1=2
- Func check4update()
- $onlineversion = _INetGetSource($updatesite)
- If StringInStr($onlineversion,"block") Then
- MsgBox(16,"GCS has been deactivated","GCS has been temporary deativated !" & @crlf & "Please be patient and contact the author !")
- Exit
- EndIf
- If $onlineversion <> $version Then
- ProgressOn("Update", "Update to Version " & $onlineversion, _INetGetSource($updateinfo))
- $errcheck = InetGet($dlsource, "GCS." & $onlineversion & ".exe", 1, 1)
- $allsize = InetGetSize($dlsource)
- If $allsize = @error Or $errcheck = @error Then
- ProgressOff()
- MsgBox(16, "Error","No Connection to the Update-Pack")
- Return 0
- EndIf
- While @InetGetActive
- ProgressSet((@InetGetBytesRead / $allsize) * 100)
- Sleep(250)
- WEnd
- ProgressOff()
- MsgBox(64,"Update","Update from " & $version & " to " & $onlineversion & " sucessfull." & @crlf & "GCS restarts now.")
- FileWriteLine("del.cmd", "ping -n 2 localhost >NUL")
- FileWriteLine("del.cmd", "del /f """ & @ScriptFullPath & """")
- FileWriteLine("del.cmd", "ren """ & @ScriptDir & "\GCS." & $onlineversion & ".exe"" """ & @ScriptName & """")
- FileWriteLine("del.cmd", "del /f del.cmd")
- FileWriteLine("del.cmd", "start """ & @ScriptFullPath & """")
- ShellExecute("del.cmd","","","open",@SW_HIDE)
- Exit
- EndIf
- EndFunc ;==>check4update
- Func OnAutoItExit()
- FileCopy("USERDATA.DAT",$dir & "\USERDATA.DAT",1)
- FileDelete("USERDATA.DAT")
- FileDelete("GCS.db")
- FileDelete("follow.db")
- EndFunc
- Func load($state)
- MouseMove(@DesktopWidth*2,@DesktopHeight*2,0)
- BlockInput($state)
- If $state = 1 Then
- $gui = GUICreate("GCS Loading",@Desktopwidth+25,@Desktopheight+65,-1,-1,0x80000000)
- FileInstall("Loadscreen.jpg",@tempdir & "\gcs_screen.jpg",1)
- $screen = GUICtrlCreatePic(@tempdir & "\gcs_screen.jpg",0,0,@Desktopwidth+25,@Desktopheight+65)
- GUICtrlSetState($screen,$GUI_DISABLE)
- $label = GUICtrlCreateLabel("0/" & $max,@desktopwidth/2,@desktopheight,300,100)
- GUICtrlSetColor($label,0xFE8700)
- GUICtrlSetBkColor($label,0x101010)
- GUICtrlSetFont($label,14.5,600)
- GUISetState()
- Return $label
- Else
- GUIDelete($gui)
- EndIf
- EndFunc
- Func loadperc1($act,$label)
- GUICtrlSetData($label,"Apply Models" & @crlf & @TAB & $act & "/" & $max)
- EndFunc
- Func loadperc2($label)
- GUICtrlSetData($label,"Restore Models")
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment