#include
#include
#include
#include
Global $record, $now, $fenstername
Global $server2, $serverpw2, $demoname2
;[Options]-----------------------------------------------------------------------------------------------
AutoItSetOption("TrayIconHide", 1)
AutoItSetOption("WinTitleMatchMode", 2)
Opt("GUIOnEventMode", 1)
;[Options]-----------------------------------------------------------------------------------------------
;[Create_GUI ($main)]-----------------------------------------------------------------------------------------------
$main = GUICreate( "Half-Live TV Client by FireFlyer", 450, 300, 100, 100)
GUICtrlCreateLabel( "This is a help to configure your HLTV Proxy", 10, 8, 300, 20)
GUICtrlCreateLabel( "You can get more help when you drive with your mouse over the text", 10, 25, 350, 20)
;[Create_GUI ($main)]-----------------------------------------------------------------------------------------------
;[Config_Read]-----------------------------------------------------------------------------------------------
$servercfg = FileReadLine( "connect.cfg", 1)
$pwcfg = FileReadLine( "connect.cfg", 2)
$demo = FileReadLine( "connect.cfg", 3)
$record2 = StringLeft( $demo, 6)
$servercfg2 = StringMid( $servercfg, 9)
$pwcfg2 = StringMid( $pwcfg, 16)
$demo2 = StringMid( $demo, 
;[Config_Read]-----------------------------------------------------------------------------------------------
;[IP, PW, Name_Labels]-----------------------------------------------------------------------------------------------
GUICtrlCreateLabel( "Server IP:", 10, 53, 100, 20)
$server = GUICtrlCreateInput( $servercfg2, 120, 50, 150, 20)
GUICtrlCreateLabel( "(Example: 85.214.40.16:27100)", 275, 53, 200, 20)
GUICtrlCreateLabel( "Serverpassword:", 10, 83, 100, 20)
$serverpw = GUICtrlCreateInput( $pwcfg2, 120, 80, 150, 20)
GUICtrlCreateLabel( "(Example: Password)", 275, 83, 200, 20)
GUICtrlCreateLabel( "Demoname:", 10, 112, 100, 20)
$demoname = GUICtrlCreateInput( $demo2, 120, 110, 150, 20)
;GUICtrlCreateLabel( "(Example: Name)", 275, 112, 200, 20)
$record = GUICtrlCreateCheckbox( "Record Demo", 280, 112, 100, 20)
$heightctime = 142
GUICtrlCreateLabel( "Current Date/Time: ", 10, $heightctime, 100, 20)
$now2 = GUICtrlCreateLabel( $now, 120, $heightctime, 100, 20)
;[IP, PW, Name_Labels]-----------------------------------------------------------------------------------------------
;[START_TIME]-----------------------------------------------------------------------------------------------
GUICtrlCreateLabel( "Start-time for HLTV:", 10, 172, 100, 20)
$sleftdate = 119
$stopdate = 170
$sday2 = GUICtrlCreateInput( @MDAY, $sleftdate, $stopdate, 20, 20, $ES_NUMBER)
GUICtrlCreateLabel( ".", $sleftdate + 22, $stopdate + 5, 5, 20)
$smonth2 = GUICtrlCreateInput( @MON, $sleftdate + 27, $stopdate, 20, 20, $ES_NUMBER)
GUICtrlCreateLabel( ".", $sleftdate + 49, $stopdate + 5, 5, 20)
$syear2 = GUICtrlCreateInput( @YEAR, $sleftdate + 54, $stopdate, 32, 20, $ES_NUMBER)
$slefttime = 220
$stoptime = 170
$shour2 = GUICtrlCreateInput( @HOUR, $slefttime, $stoptime, 20, 20, $ES_NUMBER)
GUICtrlCreateLabel( ":", $slefttime + 22, $stoptime + 2, 5, 20)
$smin2 = GUICtrlCreateInput( @MIN, $slefttime + 27, $stoptime, 20, 20, $ES_NUMBER)
$stimercheckbox2 = GUICtrlCreateCheckbox( "Use Timer", 280, 170, 70, 20)
GUICtrlSetLimit($sday2, 2)
GUICtrlSetLimit($smonth2, 2)
GUICtrlSetLimit($syear2, 4)
GUICtrlSetLimit($shour2, 2)
GUICtrlSetLimit($smin2, 2)
;[START_TIME]-----------------------------------------------------------------------------------------------
;[END_TIME]-----------------------------------------------------------------------------------------------
GUICtrlCreateLabel( "End-time for HLTV:", 10, 205, 100, 20)
$eleftdate = 119
$etopdate = 201
$eday2 = GUICtrlCreateInput( @MDAY, $eleftdate, $etopdate, 20, 20, $ES_NUMBER)
GUICtrlCreateLabel( ".", $eleftdate + 22, $etopdate + 5, 5, 20)
$emonth2 = GUICtrlCreateInput( @MON, $eleftdate + 27, $etopdate, 20, 20, $ES_NUMBER)
GUICtrlCreateLabel( ".", $eleftdate + 49, $etopdate + 5, 5, 20)
$eyear2 = GUICtrlCreateInput( @YEAR, $eleftdate + 54, $etopdate, 32, 20, $ES_NUMBER)
$elefttime = 220
$etoptime = 201
$ehour2 = GUICtrlCreateInput( @HOUR, $elefttime, $etoptime, 20, 20, $ES_NUMBER)
GUICtrlCreateLabel( ":", $elefttime + 22, $etoptime + 2, 5, 20)
$emin2 = GUICtrlCreateInput( @MIN, $elefttime + 27, $etoptime, 20, 20, $ES_NUMBER)
$etimercheckbox2 = GUICtrlCreateCheckbox( "Use Timer", 280, 201, 70, 20)
GUICtrlSetLimit($eday2, 2)
GUICtrlSetLimit($emonth2, 2)
GUICtrlSetLimit($eyear2, 4)
GUICtrlSetLimit($ehour2, 2)
GUICtrlSetLimit($emin2, 2)
;[END_TIME]-----------------------------------------------------------------------------------------------
;[Buttons]-----------------------------------------------------------------------------------------------
$heightbutton = 250
$start = GUICtrlCreateButton( "Start HLTV", 10, $heightbutton, 75, 25)
GUICtrlSetOnEvent($start, "start_hltv")
$end = GUICtrlCreateButton( "End HLTV", 90, $heightbutton, 75, 25)
GUICtrlSetOnEvent($end, "end_hltv")
$folder = GUICtrlCreateButton( "Demo-Folder", 170, $heightbutton, 75, 25)
GUICtrlSetOnEvent($folder, "Folder")
$options = GUICtrlCreateButton( "Advanced Options", 250, $heightbutton, 110, 25)
GUICtrlSetOnEvent($options, "Optionen_fenster")
$exit = GUICtrlCreateButton( "Exit", 365, $heightbutton, 75, 25)
GUICtrlSetOnEvent($exit, "GUI_Exit")
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Exit")
;[Buttons]-----------------------------------------------------------------------------------------------
GUISetState(@SW_SHOW, $main)
;[GUI_Create ($options)]-----------------------------------------------------------------------------------------------
$optionen = GUICreate( "Half-Live TV Advanced Options by FireFlyer", 450,500,300,300)
;LABELS
GUICtrlCreateLabel( "Here you can modify the most important options", 10, 10, 300, 15)
GUICtrlCreateLabel( "\\Name-Settings", 10, 40, 100, 15)
GUICtrlCreateLabel( "Name", 10, 60, 100, 15)
GUICtrlCreateLabel( "Hostname", 10, 80, 100, 15)
GUICtrlCreateLabel( "\\Password-Settings", 10, 110, 100, 15)
GUICtrlCreateLabel( "Admin-Password", 10, 130, 100, 15)
GUICtrlCreateLabel( "Server-Password", 10, 150, 100, 15)
GUICtrlCreateLabel( "Proxy-Password", 10, 170, 100, 15)
GUICtrlCreateLabel( "Spectator-Password", 10, 190, 100, 15)
GUICtrlCreateLabel( "\\Connection-Settings", 10, 220, 100, 15)
GUICtrlCreateLabel( "Rate", 10, 240, 100, 15)
GUICtrlCreateLabel( "Updaterate", 10, 260, 100, 15)
GUICtrlCreateLabel( "MaxRate", 10, 280, 100, 15)
GUICtrlCreateLabel( "MaxLoss", 10, 300, 100, 15)
;INPUTS
GUISetState(@SW_HIDE, $optionen)
;[GUI_Create ($options)]-----------------------------------------------------------------------------------------------
Func start_hltv()
$fenstername = "HLTV - "&$server2
FileDelete( "connect.cfg" )
FileWriteLine ( "connect.cfg", "connect "&$server2)
FileWriteLine ( "connect.cfg", "serverpassword "&$serverpw2)
If GuiCtrlRead($record) = $GUI_CHECKED Then
FileWriteLine ( "connect.cfg", "record "&$demoname2)
EndIf
sleep(100)
If Not ProcessExists("hltv.exe") Then
run( "hltv.exe")
WinActivate( "HLTV - ")
sleep(1000)
WinActivate( "HLTV")
Send( "exec connect.cfg")
sleep(1000)
Send("{Enter}")
sleep(2000)
WinSetState("HLTV - ", "", @SW_MINIMIZE)
EndIf
EndFunc
Func end_hltv()
WinActivate("HLTV - ")
If WinActive ($fenstername) Or WinActive ("HLTV - offline") Then
Send( "exit")
sleep(300)
Send( "{ENTER}")
$etimercheckbox = GUICtrlRead( $etimercheckbox2)
If $etimercheckbox = $GUI_CHECKED Then
GUICtrlSetState($etimercheckbox2, $GUI_UNCHECKED)
EndIf
Else
MsgBox(0, "Error", "HLTV is not opened")
EndIf
EndFunc
Func Folder()
run( @Windowsdir&"\explorer.exe "&@WorkingDir&"\cstrike")
EndFunc
Func Optionen_fenster()
GUISetState(@SW_SHOW, $optionen)
GUISetOnEvent($GUI_EVENT_CLOSE, "Optionen_fenster_schliessen")
EndFunc
Func Optionen_fenster_schliessen()
GUISetState(@SW_HIDE, $optionen)
EndFunc
Func GUI_Exit()
If ProcessExists( "hltv.exe") Then
MsgBox(0, "Attention", "HLTV is already running!")
Else
Exit
EndIf
EndFunc
Func GetPos()
$a = GUIGetCursorInfo($main)
;_ArrayDisplay($a)
Select
Case not @error And $a[4] = "5" ;server IP
ToolTip("This is the IP where the HLTV Proxy will connect on")
Case not @error And $a[4] = "8" ;server PW
ToolTip("If the GameServer is password-protected type the password in here")
Case not @error And $a[4] = "11" ;DemoName
ToolTip("Demos will be saved with the NAME-YYMMDDhhmm-map.dem")
Case Else
ToolTip("")
EndSelect
EndFunc
Func GetTime()
$now = _Now()
ControlSetText( "", "", $now2, $now)
Sleep(500)
EndFunc
Func Demo_Checkbox()
$server2 = GUICtrlRead( $server, 1)
$serverpw2 = GUICtrlRead( $serverpw, 1)
$demoname2 = GUICtrlRead( $demoname, 1)
If $demoname2 = "" Then
GUICtrlSetState( $record, $GUI_UNCHECKED)
Else
GUICtrlSetState( $record, $GUI_CHECKED)
EndIf
EndFunc
Func stime()
$sday = GUICtrlRead( $sday2)
$smonth = GUICtrlRead( $smonth2)
$syear = GUICtrlRead( $syear2)
$shour = GUICtrlRead( $shour2)
$smin = GUICtrlRead( $smin2)
$stimercheckbox = GUICtrlRead( $stimercheckbox2)
If $stimercheckbox = $GUI_CHECKED Then
If $sday = @MDAY And $smonth = @MON And $syear = @YEAR And $shour = @HOUR And $smin = @MIN And @SEC = 00 Then
start_hltv()
EndIf
EndIf
EndFunc
Func etime()
$eday = GUICtrlRead( $eday2)
$emonth = GUICtrlRead( $emonth2)
$eyear = GUICtrlRead( $eyear2)
$ehour = GUICtrlRead( $ehour2)
$emin = GUICtrlRead( $emin2)
$etimercheckbox = GUICtrlRead( $etimercheckbox2)
If $etimercheckbox = $GUI_CHECKED Then
If $eday = @MDAY And $emonth = @MON And $eyear = @YEAR And $ehour = @HOUR And $emin = @MIN And @SEC = 00 Then
end_hltv()
EndIf
EndIf
EndFunc
While 1
GetPos()
GetTime()
Demo_Checkbox()
stime()
etime()
WEnd
</Date.au3></Array.au3></File.au3></GUIConstants.au3>