#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=main.ico
#AutoIt3Wrapper_Outfile=S4Brick.exe
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Comment=Auto-shoot S4 League
#AutoIt3Wrapper_Res_Description=Auto-shoot S4 League
#AutoIt3Wrapper_Res_Fileversion=0.0.0.1
#AutoIt3Wrapper_Res_ProductVersion=0.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=2014 - BrickMe
#AutoIt3Wrapper_Res_Language=1036
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <EditConstants.au3>
#include <Color.au3>
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $title = "S4 Client"
Global $On = 0, $On2 = 0
Global $Pid, $dll, $dll2
Global $White[3] = [255,255,255]
AdlibRegister("_HotKeySet")
Global $Form1 = GUICreate("S4Brick", 594, 309, -1, -1)
$Edit1 = _GUICtrlRichEdit_Create($Form1, "", -1, -1, 594, 309, BitOR($ES_READONLY, $WS_VSCROLL, $ES_MULTILINE))
_GUICtrlRichEdit_SetBkColor($Edit1, "0")
_GUICtrlRichEdit_AppendText($Edit1, "S4Brick > F11 pour lancer ou arrêter l'auto-shoot" & @CRLF & "S4Brick >")
_GUICtrlRichEdit_SetCharColor($Edit1, _ColorSetCOLORREF($White))
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_GUICtrlRichEdit_AppendText($Edit1, " Arrêt de S4Brick...")
Exit
EndSwitch
WEnd
Func _func()
_GUICtrlRichEdit_AppendText($Edit1," En attente de S4 League..." & @CRLF & "S4Brick >")
While WinExists($title) <> 1
$sf = _stopFunc()
If $sf = 1 Then
Return
EndIf
Sleep(250)
WEnd
_GUICtrlRichEdit_AppendText($Edit1," S4 League trouvé - AutoShoot actif" & @CRLF & "S4Brick >")
$hwnd = WinGetHandle($title)
$s = WinGetClientSize($hwnd)
WinActivate($hwnd)
Sleep(500)
While 1
$pix = PixelSearch(($s[0] / 2) - 100, ($s[1] /2) - 100, ($s[0] / 2) + 100, ($s[1] / 2) + 100, 0xFF0000, 0, 1, $hwnd)
If Not @error Then
DllCall("user32.dll", "NONE", "mouse_event", "DWORD", 0x0002, "DWORD", 1, "DWORD", 1, "DWORD", 0, "ULONG_PTR", 0)
Sleep(250)
DllCall("user32.dll", "NONE", "mouse_event", "DWORD", 0x0004, "DWORD", 1, "DWORD", 1, "DWORD", 0, "ULONG_PTR", 0)
EndIf
$sf = _stopFunc()
If $sf = 1 Then
Return
EndIf
WEnd
EndFunc
Func _HotKeySet()
$dll = DllCall("user32.dll", "SHORT", "GetKeyState", "int", 0x7A)
If $dll[0] = 1 Then
If $On = 0 Then
_GUICtrlRichEdit_AppendText($Edit1," Lancement de S4Brick - AutoShoot" & @CRLF & "S4Brick >")
AdlibRegister("_func")
$On = 1
EndIf
EndIf
$dll2 = DllCall("user32.dll", "SHORT", "GetKeyState", "int", 0x7B)
If $dll2[0] = 1 Then
If $On = 0 Then
_GUICtrlRichEdit_AppendText($Edit1," Lag..." & @CRLF & "S4Brick >")
_lag()
$On = 1
EndIf
EndIf
EndFunc
Func _stopFunc()
$dll = DllCall("user32.dll", "SHORT", "GetKeyState", "int", 0x7A)
If $dll[0] = 0 Then
If $On = 1 Then
_GUICtrlRichEdit_AppendText($Edit1," Arrêt de S4Brick - AutoShoot" & @CRLF & "S4Brick >")
AdlibUnRegister("_func")
$On = 0
Return 1
EndIf
EndIf
EndFunc
Func _lag()
$dll2[0] = 1
Run('C:\Windows\System32\netsh.exe advfirewall firewall set rule name="blocknet" new enable="no"', "", @SW_HIDE)
Sleep(5000)
Run('C:\Windows\System32\netsh.exe advfirewall firewall set rule name="blocknet" new enable="yes"', "", @SW_HIDE)
$On = 0
EndFunc