Edit real problem:
ExitLoop actually works. The part that is not working is the switch. Although I set $AA to 1 in the If statement, the script it goes again into Case $AA = 0. Why is that so? I declared on the top of the script Global $AA = 0
Code:
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $CheckboxOnOff
$On = True
Case $GUI_EVENT_CLOSE
Exit
Case $AA = 0
If GUICtrlRead($CheckboxAA) = $GUI_CHECKED Then
WinSetState("MWarTool","",@SW_MINIMIZE)
While Sleep(30)
ToolTip("Go to the center of your Attack Button and press F2")
If _IsPressed(71) Then
$mPos = MouseGetPos()
$Color = PixelGetColor($mPos[0],$mPos[1])
MsgBox(0,"",$AA)
$AA = 1
ToolTip("")
WinSetState("MWarTool","",@SW_RESTORE)
MsgBox(0,"",$AA)
ExitLoop
EndIf
WEnd
EndIf
EndSwitch
WEnd