Code:
#include <GUIConstantsEx.au3>
$check = WinExists("Combat_Arms")
Opt('MustDeclareVars', 1)
HotKeySet("{esc}", "kill")
Func kill()
Exit
EndFunc
ui()
Func ui()
Local $Invitebutton, $afk, $msg, $runjump
Global $invite, $startnotification, $joinclicks, $nade
GUICreate("CA bot", 300, 75)
Opt("GUICoordMode", 2)
$Invitebutton = GUICtrlCreateButton("InviteBot", 50, 30, 100)
$afk = GUICtrlCreateButton("AfkNade", 0, -1)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Invitebutton
if $check = 0 Then Call("Fail")
$invite = 6
$startnotification = Random(1,100)
WinActivate("Combat_Arms")
Sleep(10000)
Beep(500, 100)
Send($startnotification&"{enter}")
MouseMove(1,1)
Do
MouseClick("primary", 574,515,1)
MouseClick("primary", 512, 477, 10)
$invite = $invite - 1
if $invite > 1 Then Call("SEcountdown")
If $invite = 1 Then Call("grammar")
If $invite = 0 Then Call("endnotification")
Sleep(10000)
Until $invite = 0
Case $msg = $afk
if $check = 0 Then Call("Fail")
WinActivate("Combat_Arms")
Sleep(10000)
Call("join")
EndSelect
WEnd
EndFunc
Func Fail()
MsgBox(1, "Failed", "Combat Arms is not open.")
Exit
EndFunc
Func join()
Global $joinclicks
Beep(500,100)
Do
$joinclicks = $joinclicks + 1
if $joinclicks = 6 then Call("reset")
MouseClick("primary", 247, 516, 1, 10)
MouseClick("primary", 512, 472, 1, 10)
Until $joinclicks = 5
MouseClick("primary", 451, 517, 1, 20)
sleep(10000)
Call("nade")
EndFunc
Func nade()
Global $nade
Do
Beep(500,100)
Send("{4}")
MouseClick("primary", 400,600, 2, 10)
Sleep(12000)
$nade = $nade + 1
if $nade = 3 Then Call("reset")
Until $nade = 2
Call("join")
EndFunc
Func reset()
Global $joinclicks, $nade
$joinclicks = 0
$nade = 0
EndFunc
Func SEcountdown()
Global $invite
Send("Sending out "&$invite&" more invites.{enter}")
EndFunc
Func grammar()
Global $invite
Send("Sending out "&$invite&" more invite.{enter}")
EndFunc
Func endnotification()
Send("No more invites. Ready or not, I'm starting.{enter}")
EndFunc