Guest User

Trooper

a guest
Jan 2nd, 2010
1,696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.34 KB | None | 0 0
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_icon=C:\Users\Nick\Pictures\icons\Icon_384.ico
  3. #AutoIt3Wrapper_UseUpx=n
  4. #AutoIt3Wrapper_Res_Description=(c) Trooper
  5. #AutoIt3Wrapper_Res_Fileversion=1.1
  6. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  7.  
  8.  
  9. #NoTrayIcon
  10. #include <INet.au3>
  11. #include <Process.au3>
  12. #include <GUIConstantsEx.au3>
  13. #Include <Array.au3>
  14. Global $updatesite = "http://fcbolzplatz.fc.funpic.de/QLUpdate/gcs.version", $dlsource = "http://fcbolzplatz.fc.funpic.de/QLUpdate/gcs_eng.exe"
  15. Global $updateinfo = "http://fcbolzplatz.fc.funpic.de/QLUpdate/gcs.update.info", $version = "1.1", $mainfile = "http://fcbolzplatz.fc.funpic.de/GCS/datei.txt"
  16. Global $dir = @ScriptDir, $gui, $max
  17. Opt("OnExitFunc","OnAutoItExit")
  18. Opt("TrayAutoPause",0)
  19. Opt("TrayMenuMode",1)
  20. TraySetToolTip("Global Custom Skins" & @crlf & "Version " & $version & @crlf & "(C) Nicksoft")
  21. Global $trayexit = TrayCreateItem("Exit")
  22.  
  23. If not FileExists("img.exe") Then
  24. MsgBox(16,"Error","Uncomplete Package of GCS")
  25. Exit
  26. EndIf
  27.  
  28. FileDelete("GCS.db")
  29. FileDelete("follow.db")
  30. FileWrite("GCS.db",_INetGetSource($mainfile))
  31.  
  32. If Not FileExists(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","Pfad") & "\gta_sa.exe") Then
  33. If FileExists("gta_sa.exe") Then
  34. RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","Pfad","REG_SZ",@Scriptdir)
  35. Else
  36. Do
  37. $dir = FileSelectFolder("Choose GTA SA Folder","")
  38. If @error Then Exit
  39. If Not FileExists($dir & "\gta_sa.exe") Then MsgBox(16,"Error","The chosen Folder doesn�t contain GTA San Andreas")
  40. If FileExists($dir & "\gta_sa.exe") Then ExitLoop
  41. Until 1=2
  42. RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","Pfad","REG_SZ",$dir)
  43. EndIf
  44. RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","","REG_SZ","(C) Trooper")
  45. Else
  46. $dir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins","Pfad")
  47. EndIf
  48.  
  49. check4update()
  50.  
  51. If ProcessExists("gta_sa.exe") Then
  52. MsgBox(16,"Error","You have to start GCS before cocnnecting to a server !")
  53. Exit
  54. EndIf
  55. Sleep(500)
  56. Do
  57. Do
  58. $tmsg = TrayGetMsg()
  59. If $tmsg = $trayexit Then Exit
  60. If Not ProcessExists("samp.exe") Then Exit
  61. Until WinExists("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]") And WinGetTitle("[ACTIVE]") = "Server Properties - ( Just click ""Connect""! )"
  62. $serverip = ControlGetText("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]","","[CLASS:TEdit; INSTANCE:3]")
  63. #cs
  64. If StringInStr($serverip,"127.0.0.1") Then
  65. WinSetTitle("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]","","Server Properties [Localhost]")
  66. ContinueLoop
  67. EndIf
  68. If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip) = "Done" Then
  69. ContinueLoop
  70. ElseIf RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip) = "loaded" Then ;existiert und wurde geladen
  71. $id = Random(1,10000000000000000,1)
  72. ControlDisable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]", "", "[CLASS:TButton; INSTANCE:1]")
  73. ProgressOn("Global Custom Skins","Download gefunden","Models wiederherstellen",@DesktopWidth-325,@DesktopHeight-200)
  74. FileMove($dir & "\models\gta3.img",$dir & "\models\gta3.img.old." & $id)
  75. FileMove($dir & "\models\gta3.img." & Stringreplace($serverip,":","-"),$dir & "\models\gta3.img",1)
  76. ProgressOff()
  77. ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
  78. Sleep(750)
  79. ControlClick( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
  80. Sleep(10000)
  81. Do
  82. Sleep(3000)
  83. Until not ProcessExists("gta_sa.exe")
  84.  
  85. ProgressOn("Global Custom Skins","Beenden","Wiederherstellen von alten Models",@DesktopWidth-325,@DesktopHeight-200)
  86. FileMove($dir & "\models\gta3.img" ,$dir & "\models\gta3.img." & Stringreplace($serverip,":","-"),1)
  87. FileMove($dir & "\models\gta3.img.old." & $id,$dir & "\models\gta3.img",1)
  88. ProgressOff()
  89. ContinueLoop
  90. ElseIf RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip) = "perma" Then
  91. ControlClick( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
  92. Sleep(10000)
  93. Do
  94. Sleep(3000)
  95. Until not ProcessExists("gta_sa.exe")
  96. ContinueLoop
  97. EndIf
  98. #ce
  99.  
  100. ControlDisable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
  101. ProgressOn("Global Custom Skins","Apply Skins","Connect to Main-Server",@DesktopWidth-325,@DesktopHeight-200)
  102. $readextern = IniRead("GCS.db","DB",$serverip,"error")
  103. If $readextern = "error" Then
  104. ProgressOff()
  105. ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
  106. ; RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip,"REG_SZ","Done")
  107. FileDelete("follow.db")
  108. WinSetTitle("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]","","Server Properties [Not Found in DB]")
  109. ContinueLoop
  110. EndIf
  111. ProgressSet(0,"Connect to 3rd Party Database")
  112. FileWrite("follow.db",_INetGetSource($readextern))
  113. $status = IniRead("follow.db","Status","Status","down")
  114. If $status <> "up" Then
  115. ProgressOff()
  116. MsgBox(16,"Error","The requested Server is GCS registered, but the configure file doesn�t exists !")
  117. ; RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip,"REG_SZ","Done")
  118. ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
  119. FileDelete("follow.db")
  120. WinSetTitle("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]","","Server Properties [Error-1]")
  121. ContinueLoop
  122. EndIf
  123. $numberofdownloads = IniReadSection("follow.db","Downloads")
  124. If @error Then
  125. ProgressOff()
  126. MsgBox(16,"Error","The requested Server have an existing, but damaged configure file.")
  127. ; RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip,"REG_SZ","Done")
  128. ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]", "", "[CLASS:TButton; INSTANCE:1]")
  129. FileDelete("follow.db")
  130. WinSetTitle("[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties;ACTIVE]","","Server Properties [Error-2]")
  131. ContinueLoop
  132. EndIf
  133.  
  134. ProgressSet(0,"Backup Models" & @crlf & "The copy progress isn�t shown," & @crlf & "please be patient !")
  135. $tvar = Stringreplace($serverip,":","-")
  136.  
  137. If Not FileExists($dir & "\models\gta3.img.GCS") Then FileCopy($dir & "\models\gta3.img", $dir & "\models\gta3.img.GCS")
  138.  
  139. $editimg = $dir & "\models\gta3.img.GCS"
  140. ProgressOff()
  141. DirCreate(@ScriptDir & "\restore")
  142.  
  143. Global $max = $numberofdownloads[0][0]
  144. $tlabel = load(1)
  145. loadperc1(0,$tlabel)
  146. ShellExecute("img.exe","","","open",@SW_HIDE)
  147. Do
  148. Sleep(250)
  149. Until ProcessExists("img.exe")
  150. Sleep(1000)
  151. $ttitle = WinGetTitle("")
  152. If WinExists("[TITLE:" & $ttitle & ";CLASS:ConsoleWindowClass]") Then
  153. $title = "[TITLE:" & $ttitle & ";CLASS:ConsoleWindowClass]"
  154. Else
  155. $title = "[CLASS:ConsoleWindowClass]"
  156. Do
  157. ProcessClose("cmd.exe")
  158. Until not ProcessExists("cmd.exe")
  159. EndIf
  160. ControlSend($title,"","","-open """ & $editimg & """{ENTER}")
  161.  
  162.  
  163. For $loop = 1 To $numberofdownloads[0][0]
  164. $dllink = IniRead("follow.db","Downloads",$loop,"error")
  165. If $dllink = "error" Then ContinueLoop
  166. ;ProgressSet(($loop / $numberofdownloads[0][0]) * 100,"Downloade " & $dllink)
  167. loadperc1($loop,$tlabel)
  168. $split = StringSplit($dllink,"/")
  169. $dateiname = $split[$split[0]]
  170. FileDelete(@ScriptDir & "\" & $dateiname)
  171. InetGet($dllink,@ScriptDir & "\" & $dateiname,1)
  172. Sleep(500)
  173. ;ProgressSet(($loop / $numberofdownloads[0][0]) * 100,"Integriere " & $dllink)
  174. Sleep(250)
  175. ControlFocus($title,"","")
  176. ControlSend($title,"","","-export """ & $dateiname & """ """ & @ScriptDir & "\restore"" {ENTER}")
  177. Sleep(250)
  178. ControlFocus($title,"","")
  179. ControlSend($title,"","","-import """ & @ScriptDir & "\" & $dateiname & """{ENTER}")
  180. Sleep(250)
  181. FileDelete($dateiname)
  182. Next
  183. Sleep(250)
  184. ControlSend($title,"","","-save {ENTER}")
  185. Sleep(250)
  186. ControlSend($title,"","","-close {ENTER}")
  187. Sleep(500)
  188. load(0)
  189. Do
  190. ProcessClose("img.exe")
  191. Until Not ProcessExists("img.exe")
  192. FileDelete("follow.db")
  193. $id = Random(1,10000000000000000,1)
  194. ProgressSet(0,"Benutze Modelset")
  195. FileMove($dir & "\models\gta3.img",$dir & "\models\gta3.img.old",1)
  196. FileMove($dir & "\models\gta3.img.GCS",$dir & "\models\gta3.img",1)
  197. ; RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Global Custom Skins",$serverip,"REG_SZ","loaded")
  198. ; ProgressOff()
  199. ControlEnable( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]", "", "[CLASS:TButton; INSTANCE:1]")
  200. Sleep(750)
  201. ControlClick( "[TITLE:Server Properties - ( Just click ""Connect""! ); CLASS:TfmServerProperties]", "", "[CLASS:TButton; INSTANCE:1]")
  202. Sleep(10000)
  203. Do
  204. Sleep(2000)
  205. Until not ProcessExists("gta_sa.exe")
  206. WinSetState("[CLASS:TfmMain]","",@SW_DISABLE)
  207. ; ProgressOn("Global Custom Skins","Beenden","Wiederherstellen von alten Models",@DesktopWidth-325,@DesktopHeight-200)
  208. FileMove($dir & "\models\gta3.img" ,$dir & "\models\gta3.img.GCS",1)
  209. FileMove($dir & "\models\gta3.img.old",$dir & "\models\gta3.img",1)
  210. $tlabel = load(1)
  211. loadperc2($tlabel)
  212. ShellExecute("img.exe","","","open",@SW_HIDE)
  213. Do
  214. Sleep(250)
  215. Until ProcessExists("img.exe")
  216. Sleep(1000)
  217. $ttitle = WinGetTitle("")
  218. If WinExists("[TITLE:" & $ttitle & ";CLASS:ConsoleWindowClass]") Then
  219. $title = "[TITLE:" & $ttitle & ";CLASS:ConsoleWindowClass]"
  220. Else
  221. $title = "[CLASS:ConsoleWindowClass]"
  222. Do
  223. ProcessClose("cmd.exe")
  224. Until not ProcessExists("cmd.exe")
  225. EndIf
  226. ControlSend($title,"","","-open """ & $editimg & """{ENTER}")
  227. Sleep(250)
  228. $resetdff = FileFindFirstFile(@ScriptDir & "\restore\*.dff")
  229. Do
  230. $dffreset = FileFindNextFile($resetdff)
  231. If @error Then ExitLoop
  232. ControlFocus($title,"","")
  233. ControlSend($title,"","","-import """ & @ScriptDir & "\restore\" & $dffreset & """ {ENTER}")
  234. Sleep(250)
  235. Until 1=2 ;bis abbruch
  236. $resettxd = FileFindFirstFile(@ScriptDir & "\restore\*.txd")
  237. Do
  238. $txdreset = FileFindNextFile($resettxd)
  239. If @error Then ExitLoop
  240. ControlFocus($title,"","")
  241. ControlSend($title,"","","-import """ & @ScriptDir & "\restore\" & $txdreset & """ {ENTER}")
  242. Sleep(250)
  243. Until 1=2 ;bis abbruch
  244. Sleep(250)
  245. ControlFocus($title,"","")
  246. ControlSend($title,"","","-save {ENTER}")
  247. Sleep(250)
  248. ControlFocus($title,"","")
  249. ControlSend($title,"","","-close {ENTER}")
  250. Sleep(500)
  251. load(0)
  252. Do
  253. ProcessClose("img.exe")
  254. Until Not ProcessExists("img.exe")
  255. FileDelete(@scriptdir & "\restore\*.txd")
  256. FileDelete(@scriptdir & "\restore\*.dff")
  257. WinSetState("[CLASS:TfmMain]","",@SW_ENABLE)
  258. ; ProgressOff()
  259. Until 1=2
  260.  
  261.  
  262. Func check4update()
  263. $onlineversion = _INetGetSource($updatesite)
  264. If StringInStr($onlineversion,"block") Then
  265. MsgBox(16,"GCS has been deactivated","GCS has been temporary deativated !" & @crlf & "Please be patient and contact the author !")
  266. Exit
  267. EndIf
  268. If $onlineversion <> $version Then
  269. ProgressOn("Update", "Update to Version " & $onlineversion, _INetGetSource($updateinfo))
  270. $errcheck = InetGet($dlsource, "GCS." & $onlineversion & ".exe", 1, 1)
  271. $allsize = InetGetSize($dlsource)
  272. If $allsize = @error Or $errcheck = @error Then
  273. ProgressOff()
  274. MsgBox(16, "Error","No Connection to the Update-Pack")
  275. Return 0
  276. EndIf
  277. While @InetGetActive
  278. ProgressSet((@InetGetBytesRead / $allsize) * 100)
  279. Sleep(250)
  280. WEnd
  281. ProgressOff()
  282. MsgBox(64,"Update","Update from " & $version & " to " & $onlineversion & " sucessfull." & @crlf & "GCS restarts now.")
  283. FileWriteLine("del.cmd", "ping -n 2 localhost >NUL")
  284. FileWriteLine("del.cmd", "del /f """ & @ScriptFullPath & """")
  285. FileWriteLine("del.cmd", "ren """ & @ScriptDir & "\GCS." & $onlineversion & ".exe"" """ & @ScriptName & """")
  286. FileWriteLine("del.cmd", "del /f del.cmd")
  287. FileWriteLine("del.cmd", "start """ & @ScriptFullPath & """")
  288. ShellExecute("del.cmd","","","open",@SW_HIDE)
  289. Exit
  290. EndIf
  291. EndFunc ;==>check4update
  292.  
  293. Func OnAutoItExit()
  294. FileCopy("USERDATA.DAT",$dir & "\USERDATA.DAT",1)
  295. FileDelete("USERDATA.DAT")
  296. FileDelete("GCS.db")
  297. FileDelete("follow.db")
  298. EndFunc
  299.  
  300. Func load($state)
  301. MouseMove(@DesktopWidth*2,@DesktopHeight*2,0)
  302. BlockInput($state)
  303.  
  304. If $state = 1 Then
  305. $gui = GUICreate("GCS Loading",@Desktopwidth+25,@Desktopheight+65,-1,-1,0x80000000)
  306. FileInstall("Loadscreen.jpg",@tempdir & "\gcs_screen.jpg",1)
  307. $screen = GUICtrlCreatePic(@tempdir & "\gcs_screen.jpg",0,0,@Desktopwidth+25,@Desktopheight+65)
  308. GUICtrlSetState($screen,$GUI_DISABLE)
  309. $label = GUICtrlCreateLabel("0/" & $max,@desktopwidth/2,@desktopheight,300,100)
  310. GUICtrlSetColor($label,0xFE8700)
  311. GUICtrlSetBkColor($label,0x101010)
  312. GUICtrlSetFont($label,14.5,600)
  313. GUISetState()
  314. Return $label
  315. Else
  316. GUIDelete($gui)
  317. EndIf
  318.  
  319. EndFunc
  320.  
  321. Func loadperc1($act,$label)
  322. GUICtrlSetData($label,"Apply Models" & @crlf & @TAB & $act & "/" & $max)
  323. EndFunc
  324.  
  325. Func loadperc2($label)
  326. GUICtrlSetData($label,"Restore Models")
  327. EndFunc
  328.  
Advertisement
Add Comment
Please, Sign In to add comment