Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <MsgBoxConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <Color.au3>
- #include <Date.au3>
- ;~ ; ************ EDITABLE PART ***********************
- ;~ ; **************************************************
- ;~ ; Should definitely put this in GUI
- Global Const $DROP_COMMAND_BOUND_KEY = "q"
- Global Const $TEAM_CHAT_BOUND_KEY = "u"
- ;~ ; vote, but also autobuy, so freezetime=15+buytime=20 == 35 sec, any value lower than 35 can make you buy&drop twice
- ;~ ; may be let choose this in GUI
- Global Const $MAX_SECONDS_BETWEEN_2_F1 = 20
- Global Const $MAX_SECONDS_BETWEEN_2_LOBBYTEXT = 90
- ;~ ; **************************************************
- ;~ ; ********* END OF EDITABLE PART *******************
- Global Const $MAX_RESOLUTIONS = 18
- Global Const $aResolutions[$MAX_RESOLUTIONS][2] = [[640, 480], [800, 600], [1024, 768], [1152, 864], [1280, 1024], [1400, 1050], _
- [1024, 600], [1280, 720], [1360, 768], [1366, 768], [1600, 900], [1920, 1080], _
- [720, 480], [800, 480], [1280, 768], [1280, 800], [1440, 900], [1680, 1050]]
- Global Const $1920x1080Index = 11
- Global Enum $eSilver, $eHighRank, $eUnranked
- ;~ ; keep the 10 lines below for the record
- ;~ ;Default values
- ;~ Const $_ACCEPT_MATCH_COLOUR = 878614
- ;~ Const $YELLOW_FUCKING_COLOR = 14795025
- ;~ Const $LOBBY_TEXT_COLOUR = 5797773
- ;THIS IS FOR BANANA 1600*900 settings :
- ;~ Const $_ACCEPT_MATCH_COLOUR = 2120745
- ;~ Const $YELLOW_FUCKING_COLOR = 14795030
- ;~ Const $LOBBY_TEXT_COLOUR = 8164519
- ;~ Global $aCheckLobbyPos[$MAX_RESOLUTIONS][2] = [ [222, 78] , [272, 98] , [345, 125] , [400, 140] , [430, 167] , [476, 171] , _
- ;~ [384, 98] , [493, 117] , [523, 125] , [526, 125] , [593, 148] , [730, 176] , _ ; 5th BANANA Value [593, 148] ; DEFAULT : [616, 147]
- ;~ [262, 78] , [308, 78] , [483, 125] , [476, 130] , [536, 147] , [625, 171] ]
- ;Const $steam_exe_patch = "D:\Steam\Steam.exe" ; don't use this anymore, would have to be edited, search path in regedit instead
- Global Const $csgo_exec_patch = "steam://rungameid/730" ; the only way to launch cs:go in safe VAC mode, use path with .exe would end to unsafe mode and unable to re-join match
- ; 1920x1080 accept button coordinates (316;218) (638;298)
- ;Const $COORD_ACCEPT_1080_X = 477 ; 1920 / 316 = 6.07 1920 / 638 = 3.009 USE /4
- ;Const $COORD_ACCEPT_1080_Y = 258 ; 1080 / 218 = 4.95 1080 / 298 = 3.62 USE /4
- ; (872;93) (1168;153)
- ;Const $COORD_COORD_RECONNECT_1080_X = 960 ; 872-1168 1920/872=2.20 1920/1168=1.64 USE /2 ; need to double check this because ABANDON is close :D
- ;Const $COORD_COORD_RECONNECT_1080_Y = 120 ; 1080/93=11.61 1080/153=7.05 USE /9
- ; http://www.psyclops.com/tools/rgb/
- ; https://www.binaryhexconverter.com/hex-to-decimal-converter
- ; 12,119,21 13,115,22 14,99,29 12,119,19 12,116,20 12,121,19
- ; 13,115,22 13,111,24 14,99,29 14,99,29 13,104,22 13,112,24
- ; 12,119,21 12,119,21 14,99,29 13,114,23 13,104,22 12,121,19
- ; BANANA :32,92,41 HEX:205C29 DEC:2120745 WTF, DEFAULT 13,104,22
- Global Const $aAcceptMatchColor[$MAX_RESOLUTIONS] = [816917, 881430, 942877, 816915, 816148, 817427, _
- 881430, 880408, 942877, 942877, 878614, 880664, _
- 816917, 816917, 942877, 881175, 878614, 817427]
- Global Const $aAcceptColorCheckPos[$MAX_RESOLUTIONS][2] = [[106, 132], [132, 165], [170, 211], [193, 238], [184, 282], [233, 289], _
- [244, 165], [320, 198], [338, 211], [341, 211], [400, 248], [480, 297], _
- [146, 132], [186, 132], [298, 211], [284, 220], [320, 248], [372, 289]]
- Global Const $aAcceptClicPos[$MAX_RESOLUTIONS][2] = [[106, 113], [132, 143], [170, 182], [193, 205], [184, 244], [233, 250], _
- [244, 142], [320, 172], [338, 183], [341, 183], [400, 214], [480, 257], _
- [146, 114], [186, 114], [298, 183], [284, 190], [320, 214], [372, 250]]
- ; 225,193,17 225,193,17
- ;
- ;
- ;~ Global $aReconnectYellowBannerCol[$MAX_RESOLUTIONS] = [ 14795025, 14795025, 14795025, 14795025, 14795025, 14795025, _
- ;~ 14795025, 14795025, , , , , _
- ;~ , , , , , 14795025]
- Global Const $YELLOW_BANNER_COLOR = 14795025
- ;~ ; 225,193,22 WTF BANANA > hex: E1C116 > dec: 14795030
- ;~ 224,194,22 MeaCulpa 1600*900 default files win7
- Global Const $aReconnectMatchColor[$MAX_RESOLUTIONS][2] = [[596, 33], [749, 43], [965, 53], [1091, 61], [1241, 71], [1325, 74], _
- [870, 43], [1068, 50], [1141, 53], [1137, 55], [1307, 61], [1591, 75], _
- [636, 34], [679, 34], [1098, 53], [1108, 56], [1239, 62], [1438, 73]]
- Global Const $aReconnectClicPos[$MAX_RESOLUTIONS][2] = [[347, 55], [433, 69], [557, 87], [628, 98], [700, 116], [765, 118], _
- [548, 69], [684, 82], [728, 87], [726, 86], [854, 102], [1027, 124], _
- [389, 55], [429, 56], [686, 88], [688, 90], [773, 103], [904, 119]]
- Global Const $aLobbyTextCol[$MAX_RESOLUTIONS] = [1713714, 7049128, 5600137, 7839674, 5402501, 6785704, _
- 7049128, 6917286, 6785699, 6785699, 5797773, 6193046, _
- 6917285, 6917285, 6785699, 6588063, 5797773, 6522270]
- Global Const $aCheckLobbyPos[$MAX_RESOLUTIONS][2] = [[222, 78], [272, 98], [345, 125], [400, 140], [430, 167], [476, 171], _
- [384, 98], [493, 117], [523, 125], [526, 125], [616, 147], [730, 176], _ ; 5th BANANA Value [593, 148] ; DEFAULT : [616, 147]
- [262, 78], [308, 78], [483, 125], [476, 130], [536, 147], [625, 171]]
- Global Const $aChatClicPos[$MAX_RESOLUTIONS][2] = [[276, 364], [353, 456], [553, 585], [693, 657], [835, 773], [865, 800], _
- [607, 457], [736, 547], [800, 580], [800, 580], [940, 680], [1050, 820], _
- [442, 364], [475, 363], [700, 580], [700, 600], [850, 680], [990, 790]]
- ;~ Global $aExample[$MAX_RESOLUTIONS][2] = [ [, ] , [, ] , [, ] , [, ] , [, ] , [, ] , _
- ;~ [, ] , [, ] , [, ] , [, ] , [, ] , [, ] , _
- ;~ [, ] , [, ] , [, ] , [, ] , [, ] , [, ] ]
- ;~ ; Lobby Analyser datas
- ;~ Global Const $aOwnAvatarExtraBorderColor[3] = [227, 241, 250] ; X + 4 ; Doesn't work, it's always the host extraborder, not own player, check GO button instead
- Global Const $aAvatarBorderColor[3] = [125, 125, 125]
- ;~ Global Const $aaBordersCheckZonesCoord[5][3] = [[850, 227], [1026, 227], [1202, 227], [1378, 227], [1554, 227]] ; x diff = 176
- Global Const $aGoButtonColor[3] = [44, 119, 87]
- Global $g_bIsLobbyClosed = True
- Global Const $aExtraSlotBorderCoords[2] = [820,491]
- Global Const $aExtraSlotBorderColor[3] = [43,43,43]
- ;~ ; Lobby Analyser datas END
- Global Const $CSGO_WINDOW_NAME = "Counter-Strike: Global Offensive"
- Global $aClientSize[2]
- Global $begin
- ;~ Global $previousDrop = TimerInit()
- Global $previousF1 = TimerInit()
- Global $previousLobbyText = TimerInit()
- Global $analyseText = TimerInit()
- Global $lastbuttonHit = TimerInit()
- Global $DontExitAutoAcceptLoop = False
- Global $InLoop = False
- Global $AutoF1 = True
- Global $AutoReconnect = True
- Global $AutoDrop = False
- Global $AutoSpamLobby = False
- ;~ Global $g_iDropCount = 0
- Opt("GUIOnEventMode", 1)
- $GUI = GUICreate("Cs:Go Auto-Accept", 300, 150)
- GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
- $StartButtonId = GUICtrlCreateButton("GO", 40, 100, 100, 35)
- GUICtrlSetOnEvent($StartButtonId, "Start")
- $StopButtonId = GUICtrlCreateButton("STOP", 160, 100, 100, 35)
- GUICtrlSetOnEvent($StopButtonId, "Pause")
- $AutoF1CtrlId = GUICtrlCreateCheckbox("Auto F1 (votekick, surrender, autobuy)", 10, 10)
- GUICtrlSetState($AutoF1CtrlId, $GUI_CHECKED)
- GUICtrlSetOnEvent($AutoF1CtrlId, "AutoF1")
- $AutoDropCtrlId = GUICtrlCreateCheckbox("AutoDrop Weap (Autobuy has to be on F1)", 10, 30)
- ;~ guictrlsetstate ( $AutoDropCtrlId, $GUI_CHECKED )
- GUICtrlSetOnEvent($AutoDropCtrlId, "AutoDrop")
- $AutoReconnectCtrlId = GUICtrlCreateCheckbox("Auto Reconnect", 10, 50)
- GUICtrlSetState($AutoReconnectCtrlId, $GUI_CHECKED)
- GUICtrlSetOnEvent($AutoReconnectCtrlId, "AutoReconnect")
- $SpamLobbyCtrlId = GUICtrlCreateCheckbox("Spam Lobby Chat", 10, 70)
- ;~ guictrlsetstate ( $SpamLobbyCtrlId, $GUI_CHECKED )
- GUICtrlSetOnEvent($SpamLobbyCtrlId, "SpamLobby")
- HotKeySet("{f10}", "Start")
- HotKeySet("{f11}", "Pause")
- HotKeySet("{f9}", "Analyse_Lobby")
- ResetTimer()
- GUISetState(@SW_SHOW)
- Global $steam_exe_patch = RegRead("HKEY_CLASSES_ROOT\steam\Shell\Open\Command", "")
- ;~ MsgBox($MB_SYSTEMMODAL, "", "Program files are located at: " & $steam_exe_patch)
- While 1
- Sleep(50)
- GUIGetMsg()
- Local $FirstTime = True
- While $DontExitAutoAcceptLoop
- Sleep(50)
- If WinActive($CSGO_WINDOW_NAME) Then
- If GetTimerDiff() > 500 Then
- ResetTimer()
- ExecCsGoStuff()
- EndIf
- Else
- If $AutoReconnectCtrlId And ProcessExists("Steam.exe") == 0 Then
- Local $iPID = Run($steam_exe_patch)
- WinWait($iPID, "", 20)
- ElseIf $AutoReconnectCtrlId And ProcessExists("csgo.exe") == 0 Then
- Local $iPID2 = ShellExecute($csgo_exec_patch) ; how to launch in secure mode ???
- WinWait($iPID2, "", 15)
- ElseIf $FirstTime == False Then
- If GetTimerDiff() > 30000 Then ;let 30sec before re-activate cs:go window if want to disable script
- ResetTimer()
- WinActivate($CSGO_WINDOW_NAME) ; if cs:go minimized, re-activates
- WinWaitActive($CSGO_WINDOW_NAME, "", 10)
- EndIf
- Else
- $FirstTime = False
- WinActivate($CSGO_WINDOW_NAME)
- WinWaitActive($CSGO_WINDOW_NAME, "", 10)
- EndIf
- EndIf
- WEnd
- WEnd
- ;~ Func IsSteamRunning()
- ;~ Return ProcessExists("Steam.exe")
- ;~ EndFunc ;IsSteamRunning
- ;~ Func IsCsgoRunning()
- ;~ Return ProcessExists("csgo.exe")
- ;~ EndFunc ;IsCsgoRunning
- Func Close()
- Exit
- EndFunc ;==>Close
- Func Pause()
- $DontExitAutoAcceptLoop = False
- EndFunc ;==>Pause
- Func Start()
- $DontExitAutoAcceptLoop = True
- EndFunc ;==>Start
- Func GetTimerDiff()
- Return TimerDiff($begin)
- EndFunc ;==>GetTimerDiff
- Func ResetTimer()
- $begin = TimerInit()
- EndFunc ;==>ResetTimer
- Func AutoF1()
- If GUICtrlRead($AutoF1CtrlId) == $GUI_CHECKED Then
- $AutoF1 = True
- Else
- $AutoF1 = False
- EndIf
- EndFunc ;==>AutoF1
- Func SpamLobby()
- If GUICtrlRead($SpamLobbyCtrlId) == $GUI_CHECKED Then
- $AutoSpamLobby = True
- Else
- $AutoSpamLobby = False
- EndIf
- EndFunc ;==>SpamLobby
- Func AutoReconnect()
- If GUICtrlRead($AutoReconnectCtrlId) == $GUI_CHECKED Then
- $AutoReconnect = True
- Else
- $AutoReconnect = False
- EndIf
- EndFunc ;==>AutoReconnect
- Func AutoDrop()
- If GUICtrlRead($AutoDropCtrlId) == $GUI_CHECKED Then
- $AutoDrop = True
- Else
- $AutoDrop = False
- EndIf
- EndFunc ;==>AutoDrop
- Func ExecCsGoStuff()
- Local $iRes = GetCsGoResolution()
- If $iRes == -1 Then
- ;~ MsgBox(64, "Auto-Accept", "Your resolution (" & $aClientSize[0] & "x" & $aClientSize[1] & ") is not supported" & @CRLF & "Please contact the author")
- Return
- EndIf
- ;~ Local $iColor = PixelGetColor($aReconnectMatchColor[$iRes][0], $aReconnectMatchColor[$iRes][1])
- ;~ If $iColor == $YELLOW_BANNER_COLOR Then ; todo : check if there is first a popup window in witch we have to click OK
- If IsThereYellowBanner() Then ; todo : check if there is first a popup window in witch we have to click OK
- ;~ MouseClick("left", $aReconnectClicPos[$iRes][0], $aReconnectClicPos[$iRes][1]) ; reconnect area
- Reconnect()
- Else
- If IsThereAcceptButton() Then
- ;~ LobbyWrite("Accept Button Detected{Enter}")
- Accept()
- Else
- If IsLobby() Then ; IN LOBBY
- If $AutoSpamLobby == True And TimerDiff($previousLobbyText) > $MAX_SECONDS_BETWEEN_2_LOBBYTEXT * 1000 Then
- $previousLobbyText = TimerInit()
- ;~ MouseClick("left", $aChatClicPos[$iRes][0], $aChatClicPos[$iRes][1]) ; Lobby Chat Area
- ;~ Send("Only Silvers, please kick unranked{Enter}")
- ;~ Send("Auto-accept script by ConnorMcLeod using AutoIt{Enter}")
- ;~ Send("http://steamcommunity.com/groups/CsGo_AutoAccept (only sourcecode=no virus){Enter}")
- LobbyWrite("http://steamcommunity.com/groups/CsGo_AutoAccept (only sourcecode=no virus){Enter}")
- ;~ Send("Hello guys, please keep this lobby alive, i will accept all matches, and vote F1 each time{Enter}")
- LobbyWrite("Auto: Accept / Vote F1 / Reconnect / Re-launch steam and csgo{Enter}")
- LobbyWrite(StringFormat("If there is someone to kick, try to PM me on steamfriends if i am not sleeping, time here is %s{Enter}", _NowTime()))
- ;~ Send("I will launch when lobby is full{Enter}")
- EndIf
- If TimerDiff($lastbuttonHit) > 10000 Then
- Analyse_Lobby()
- EndIf
- Else ; Let's assume we are in-game
- If TimerDiff($previousF1) > $MAX_SECONDS_BETWEEN_2_F1 * 1000 Then
- $previousF1 = TimerInit()
- If $AutoF1 == True Then
- Send("{f1}") ; max kick before get kicked ??? ; vote yes to votekick or surrender ; will send autobuy as well
- If $AutoDrop == True Then
- Send($DROP_COMMAND_BOUND_KEY)
- ;~ Send( $TEAM_CHAT_BOUND_KEY )
- ;~ Send( "Dropped weapon or voted F1{Enter}" )
- EndIf
- EndIf
- EndIf
- EndIf
- EndIf
- EndIf
- EndFunc ;==>ExecCsGoStuff
- Func GetCsGoResolution()
- Local $hWnd = WinActive($CSGO_WINDOW_NAME)
- If $hWnd == 0 Then Return -1
- $aClientSize = WinGetClientSize($hWnd)
- For $iRes = 0 To $MAX_RESOLUTIONS - 1
- If $aClientSize[0] == $aResolutions[$iRes][0] And $aClientSize[1] == $aResolutions[$iRes][1] Then
- Return $iRes
- EndIf
- Next
- Return -1
- EndFunc ;==>GetCsGoResolution
- ;~ 812, 364 [144, 147, 150]
- ;~ 812, 363 [51, 53, 52][51, 52, 52][51, 52, 52][51, 52, 51][52, 53, 52]
- ;~ 1436, 1004 44,119,87 ; GO button
- Func Analyse_Lobby()
- Local $iRes = GetCsGoResolution()
- If $iRes == $1920x1080Index Then
- Local $iPlayersNum = 0
- Local $iCount = 0
- Local $aColor[3]
- Local $bLobbyHost = False
- Local $abIsSilver[5] = [False, False, False, False, False]
- Local $abIsUnranked[5] = [False, False, False, False, False]
- Local $bAdvertise = False
- If $AutoSpamLobby == True And TimerDiff($analyseText) > 15000 Then ; still something wrong here
- $bAdvertise = True
- $analyseText = TimerInit()
- EndIf
- If IsThereGoButton() Then
- $bLobbyHost = True ; will be False if match is being searched already
- EndIf
- Local $iTempCount = CountPlayers()
- If $bAdvertise == True Then
- LobbyWrite( StringFormat("[Beta] Lobby analyser : Checking %d players...{Enter}", $iTempCount))
- EndIf
- For $iCount = 0 To 4
- If $iCount >= $iTempCount Then
- If $iTempCount == 5 Then
- If $bAdvertise == True Then
- LobbyWrite( "[Beta] Lobby analyser : Exiting loop to prevent out of bound{Enter}")
- EndIf
- EndIf
- ExitLoop
- EndIf
- $abIsSilver[$iCount] = False
- $abIsUnranked[$iCount] = False
- If $iCount == 0 And $bLobbyHost == True Then
- $iCount = 1
- $iPlayersNum = 1
- EndIf
- ; Make sure we are still in lobby
- ;~ If IsLobby() Then
- ;~ $aColor = _ColorGetRGB2( 850 + 176*$iCount, 227 )
- ;~ If _ColorIsEqual($aColor, $aAvatarBorderColor) Then
- If IsSlotTaken($iCount) Then
- Sleep(800)
- $iPlayersNum += 1
- Switch GetPlayerRank($iCount) ; Enum $eSilver, $eHighRank, $eUnranked
- Case $eSilver
- $abIsSilver[$iCount] = True
- ;~ If $bAdvertise == True Then
- ;~ LobbyWrite( StringFormat("[Beta] Lobby analyser : Player %i is Silver{Enter}", $iCount+1))
- ;~ EndIf
- Case $eHighRank
- If $bLobbyHost == True Then
- LobbyWrite( StringFormat("[Beta] Lobby analyser : Kicking High Rank Player %i{Enter}", $iCount+1) )
- Beep(880, 50)
- Beep(880, 50)
- KickPlayer($iCount)
- $iCount = 0
- $iPlayersNum = 0
- EndIf
- Case $eUnranked
- If $bLobbyHost == True Then
- LobbyWrite( StringFormat("[Beta] Lobby analyser : Unranked player %i detected, waiting 3 more seconds to ensure it is not a bug{Enter}", $iPlayersNum+1) )
- Sleep(3000)
- If IsSlotTaken($iCount) Then
- Switch GetPlayerRank($iCount)
- Case $eSilver
- $abIsSilver[$iCount] = True
- ;~ If $bAdvertise == True Then
- ;~ LobbyWrite( StringFormat("[Beta] Lobby analyser : Player %i is Silver{Enter}", $iCount+1))
- ;~ EndIf
- Case $eHighRank
- LobbyWrite( StringFormat("[Beta] Lobby analyser : Kicking High Rank Player %i{Enter}", $iCount+1) )
- Beep(880, 50)
- Beep(880, 50)
- KickPlayer($iCount)
- $iCount = 0
- $iPlayersNum = 0
- Case $eUnranked
- LobbyWrite( StringFormat("[Beta] Lobby analyser : Kicking UnRanked Player %i{Enter}", $iCount+1) )
- Beep(220, 150)
- KickPlayer($iCount)
- $iCount = 0
- $iPlayersNum = 0
- EndSwitch
- Else
- ExitLoop
- EndIf
- Else
- $abIsUnranked[$iCount] = True
- EndIf
- EndSwitch
- ;~ $aColor = _ColorGetRGB2(812 + 176 * $iCount, 363) ; check rank border color
- ;~ If $aColor[0] > 50 And $aColor[0] < 60 And $aColor[1] > 50 And $aColor[1] < 60 Then
- ;~ If $aColor[2] > 5 And $aColor[2] < 60 Then
- ;~ $abIsSilver[$iCount] = True
- ;~ ElseIf $aColor[2] >= 60 Then
- ;~ If $bLobbyHost == True Then
- ;~ LobbyWrite("[Beta] Lobby analyser : Unranked player detected, waiting 3 more seconds to ensure it is not a bug{Enter}")
- ;~ KickPlayer($iCount)
- ;~ $iCount = 0
- ;~ $iPlayersNum = 0
- ;~ Else
- ;~ $abIsUnranked[$iCount] = True
- ;~ EndIf
- ;~ EndIf
- ;~ ElseIf $bLobbyHost == True Then
- ;~ KickPlayer($iCount)
- ;~ $iCount = 0
- ;~ $iPlayersNum = 0
- ;~ EndIf
- Else
- ExitLoop
- EndIf
- ;~ EndIf ; If IsLobby
- Next
- $iPlayersNum = CountPlayers()
- If $bLobbyHost Then
- If $iPlayersNum == 5 Then
- ChangeLobbyPremissions(True, True)
- LobbyWrite("Kicking extra players{Enter}")
- KickExtraPlayers()
- Sleep(100)
- If IsThereGoButton() Then
- Go()
- EndIf
- Else
- ;~ LobbyWrite("Opening Lobby{Enter}")
- ChangeLobbyPremissions(False)
- If $bAdvertise == True Then
- ;~ MouseClick("left", $aChatClicPos[$iRes][0], $aChatClicPos[$iRes][1]) ; Lobby Chat Area
- LobbyWrite(StringFormat("[Beta] Lobby analyser : Waiting for %d DERANKERS... please invite your history or friends{Enter}", 5-$iPlayersNum))
- EndIf
- EndIf
- ElseIf $bAdvertise == True Then
- For $iCount = 0 To 4
- If $iCount >= $iPlayersNum Then
- ExitLoop
- EndIf
- If $abIsSilver[$iCount] == False Then
- ;~ MouseClick("left", $aChatClicPos[$iRes][0], $aChatClicPos[$iRes][1]) ; Lobby Chat Area
- LobbyWrite(StringFormat("[Beta] Lobby analyser : Please kick Player %i High Rank ? %i OR UNRANKED ? %i{Enter}", $iCount + 1, Not($abIsSilver[$iCount]), $abIsUnranked[$iCount]))
- EndIf
- Next
- EndIf
- EndIf
- EndFunc ;==>Analyse_Lobby
- Func CountPlayers()
- ;~ Local $aColor[3], $iCount
- Local $iCount, $iPlayersNum
- For $iCount = 0 To 4
- ;~ $aColor = _ColorGetRGB2( 850 + 176*$iCount, 227 )
- ;~ If _ColorIsEqual($aColor, $aAvatarBorderColor) == False Then
- If IsSlotTaken($iCount) == False Then
- Return $iPlayersNum
- EndIf
- $iPlayersNum += 1
- Next
- Return $iPlayersNum
- EndFunc ;==>CountPlayers
- ;~ ; 820,260
- ;993,245 1036,312 -> delta 43, 67
- Func KickPlayer($_PlayerNum)
- MouseClick("right", 820 + 176 * $_PlayerNum, 260)
- MouseClick("left", 43 + 820 + 176 * $_PlayerNum, 327)
- MouseClick("left", 1060, 666)
- Sleep(300)
- ChangeLobbyPremissions( False, True )
- EndFunc ;==>KickPlayer
- ;~ ; 820,470
- Func KickExtraPlayers()
- Local $iRes = GetCsGoResolution()
- If $iRes > -1 Then
- Local $aColor[3], $iCount = 0
- For $iCount = 0 To 4
- $aColor = _ColorGetRGB2($aExtraSlotBorderCoords[0], $aExtraSlotBorderCoords[1])
- If _ColorIsEqual($aColor, $aExtraSlotBorderColor ) Then
- MouseClick("right", 820, 470)
- MouseClick("left", 863, 537)
- MouseClick("left", 1060, 666)
- Sleep(100)
- Else
- ExitLoop
- EndIf
- Next
- EndIf
- EndFunc ;==>KickExtraPlayers
- Func _ColorGetRGB2($XX, $YY)
- Local $aRRGGBB[3], $iColor
- $iColor = PixelGetColor($XX, $YY)
- $aRRGGBB[0] = _ColorGetRed($iColor)
- $aRRGGBB[1] = _ColorGetGreen($iColor)
- $aRRGGBB[2] = _ColorGetBlue($iColor)
- Return $aRRGGBB
- EndFunc ;==>_ColorGetRGB2
- Func _ColorIsEqual($aColor1, $aColor2)
- Local $iCount
- For $iCount = 0 To 2
- If $aColor1[$iCount] <> $aColor2[$iCount] Then
- Return False
- EndIf
- Next
- Return True
- EndFunc ;==>_ColorIsEqual
- ;~ ;[882, 1003]
- Func ChangeLobbyPremissions($bLock, $bForceUpdate = False)
- If $bLock <> $g_bIsLobbyClosed Or $bForceUpdate == True Then
- $g_bIsLobbyClosed = $bLock
- MouseClick("left", 882, 1003)
- If $bLock == True Then
- MouseClick("left", 1100, 570)
- Else
- MouseClick("left", 1100, 610)
- EndIf
- EndIf
- EndFunc ;==>ChangeLobbyPremissions
- Func LobbyWrite($sLobbyText)
- If IsLobby() Then
- Local $iRes = GetCsGoResolution()
- If $iRes > -1 Then
- MouseClick("left", $aChatClicPos[$iRes][0], $aChatClicPos[$iRes][1]) ; Lobby Chat Area
- Send($sLobbyText)
- EndIf
- EndIf
- EndFunc ;==>LobbyWrite
- Func IsLobby()
- Local $iRes = GetCsGoResolution()
- If $iRes > -1 Then
- Local $iColor
- $iColor = PixelGetColor($aCheckLobbyPos[$iRes][0], $aCheckLobbyPos[$iRes][1])
- If $iColor == $aLobbyTextCol[$iRes] Then ; IN LOBBY
- Return True
- EndIf
- EndIf
- Return False
- EndFunc ;==>IsLobby
- Func Accept()
- Local $iRes = GetCsGoResolution()
- If $iRes > -1 Then
- If CountPlayers() == 5 Then
- $lastbuttonHit = TimerInit()
- MouseClick("left", $aAcceptClicPos[$iRes][0], $aAcceptClicPos[$iRes][1]) ; accept are
- Return 1
- EndIf
- EndIf
- LobbyWrite("Player left{Enter}")
- Cancel()
- Return 0
- EndFunc ;==>Accept
- Func IsThereAcceptButton()
- Local $iRes = GetCsGoResolution()
- If $iRes > -1 Then
- Local $iColor
- $iColor = PixelGetColor($aAcceptColorCheckPos[$iRes][0], $aAcceptColorCheckPos[$iRes][1])
- If $iColor == $aAcceptMatchColor[$iRes] Then
- Return True
- EndIf
- EndIf
- Return False
- EndFunc ;==>IsThereAcceptButton
- Func Cancel()
- MouseClick("left", 654, 172)
- EndFunc
- Func IsThereYellowBanner()
- Local $iRes = GetCsGoResolution()
- If $iRes > -1 Then
- If PixelGetColor($aReconnectMatchColor[$iRes][0], $aReconnectMatchColor[$iRes][1]) == $YELLOW_BANNER_COLOR Then
- Return True
- EndIf
- EndIf
- EndFunc ;==>IsThereYellowBanner
- Func Reconnect()
- Local $iRes = GetCsGoResolution()
- If $iRes > -1 Then
- MouseClick("left", $aReconnectClicPos[$iRes][0], $aReconnectClicPos[$iRes][1]) ; reconnect area
- EndIf
- EndFunc ;==>Reconnect
- Func IsThereGoButton()
- Local $iRes = GetCsGoResolution()
- If $iRes == $1920x1080Index Then
- $aColor = _ColorGetRGB2(1436, 1004) ; check GO button, netgraph has to not override the 'O' letter
- If _ColorIsEqual($aColor, $aGoButtonColor) Then
- Return True
- EndIf
- EndIf
- Return False
- EndFunc ;==>IsThereGoButton
- Func Go()
- Local $iRes = GetCsGoResolution()
- If $iRes > -1 Then
- If CountPlayers() == 5 Then
- $lastbuttonHit = TimerInit()
- MouseClick("left", 1436, 1004) ; accept area
- Else
- LobbyWrite("Player left{Enter}")
- EndIf
- EndIf
- EndFunc ;==>Accept
- Func IsSlotTaken($iSlot)
- Local $aColor[3]
- $aColor = _ColorGetRGB2(850 + 176 * $iSlot, 227)
- If _ColorIsEqual($aColor, $aAvatarBorderColor) Then
- Return True
- EndIf
- Return False
- EndFunc ;==>IsSlotTaken
- ;~ Pépé Bizon: Player 2 color is 50 58 67
- ;~ Pépé Bizon: High Rankank
- ;~ Pépé Bizon: [Beta] Lobby analyser : Kicking High Rank Player 2
- Func GetPlayerRank($iPlayer) ; Global Enum $eSilver, $eHighRank, $eUnranked
- Local $aColor[3]
- $aColor = _ColorGetRGB2(812 + 176 * $iPlayer, 363) ; check rank border color
- ;~ LobbyWrite( StringFormat("Player %d color is %d %d %d{Enter}", $iPlayer+1, $aColor[0], $aColor[1], $aColor[2]) )
- If $aColor[0] >= 49 And $aColor[0] < 60 And $aColor[1] >= 49 And $aColor[1] < 60 Then ; Pépé Bizon: Player 1 color is 50 59 68
- ;~ LobbyWrite( "Silver or Unranked{Enter}" )
- If $aColor[2] >= 49 And $aColor[2] < 60 Then
- ;~ LobbyWrite( "Silver !!{Enter}" )
- Return $eSilver
- ElseIf $aColor[2] >= 60 Then
- ;~ LobbyWrite( "Unranked !!{Enter}" )
- Return $eUnranked
- EndIf
- EndIf
- ;~ LobbyWrite( "High Rankank !!{Enter}" )
- Return $eHighRank
- EndFunc ;==>GetPlayerRank
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement