Jump to content

Call Of Duty 2 Connecter (Open for Suggestions)


Prodigy
 Share

Recommended Posts

I recently created this little script to connect to a call of duty 2 server by typing the ip and password (handy when you search wars on mirc) anyways, I'm still quite new at auto it so if any of you guys has a suggestion to improve my script, i'd be glad to hear it.

Code:

dim $run
dim $exit
dim $status1
dim $status2
dim $input1
dim $input2
dim $status3
dim $box
dim $browse
dim $folder
dim $dir
dim $var
dim $poly
dim $multi
dim $ping
dim $menu



#include <GUIConstants.au3>  ;this is required for a GUI to work

if fileexists(@documentscommondir & "\cod2dir.ini") then 
    inireadsection(@documentscommondir & "\cod2dir.ini","directory")
else 
    $dir = fileselectfolder("Point to the Call of Duty 2 folder","","")
    iniwritesection("cod2dir.ini","Directory",$dir)
    filemove("cod2dir.ini",@documentscommondir)
    filemove("connect.exe",$dir)
    inireadsection(@documentscommondir & "\cod2dir.ini","directory")
    endif


$box = GUICreate ("Call of Duty 2 server connecter",750,350)
GUISetFont(14,600)
GUICtrlCreateLabel("Call of Duty 2 server connecter by Sven""Prodigy""Heusequin",10,15)
GUISetFont(12,400)
$input1 = GUICtrlCreateInput("Ip-adress",85,100,150,30)
$input2 = GUICtrlcreateinput("Password",85,135,150,30)
$RUN = GUICtrlCreateButton("Connect",10,300,120,30)
$EXIT = GUICtrlCreateButton("Exit",600,300,120,30)
$poly = GUICtrlCreateCheckbox("Turn on Polygon Tweaks?",400,100)
$Multi = GUICtrlCreateCheckbox("Turn on multi gpu for more fps?",400,120)
GUISetState()


    

If $run Then
    filedelete(@desktopdir & "\connect.exe")
    do
        
        $msg = guigetmsg()
    $status1 = guictrlread($input1)
    $status2 = guictrlread($input2)
    $status3 = GUICtrlRead($poly)
    $status4 = GUICTRLread($multi)


until $msg = $run or $msg = $exit
if $msg = $exit then Exit
    endif



if  $run then
    
    if fileexists ($dir & "\CoD2MP_s") then
        shellexecute("CoD2MP_s","",$dir,"","")
    else 
        shellexecute("CoD2MP_s.exe","",$dir,"","")
    endif
    
    if fileexists ($dir & "\CoD2mp_s.exe") then 
        shellexecute("CoD2MP_s.exe","",$dir,"","")
    Else
        shellexecute("CoD2MP_s","",$dir,"","")
        endif
    sleep(5500)
    send("²")
    send("{backspace}")
    IF $status3 = 1 then send("/r_polygonoffsetbias 16")
        send("{enter}")
        send("/r_polygonoffsetscale 4")
        send("{enter}")

    IF $status4 = 1 then send("/r_multigpu 1")
        send("{enter}")
    
    send("/password ")
    send($status2)
    send("{enter}")
    send("/connect ")
    send($status1)
    send("{enter}")
endif

And does any of you guys by any chance know if it is possible to put this into teamspeak so that I could connect through teamspeak??

Thanks in advance,

Link to comment
Share on other sites

I've had this problem as well but I can't quite remember how I resolved it (if I did). Try using Koda to move the picture to the back and bringing all the buttons to the front, that may work in conjunction with the creation order.

Link to comment
Share on other sites

Link to comment
Share on other sites

Quick warning though, watch out when you press "Insert into Scite" It will insert wherever your cursor is and overwrite any highlighted text so be wary of this, and it doesn't check to see if there's a GUI declaration already so you may end up with multiple While 1 statements and #include <GUIConstants.au3> statments. These won't cause a problem really but the extra while 1s may if you have it set so there's a notify event. So if you have

While 1
$nmsg = GUIGetMsg()
Switch $nmsg
Case $button1
*Do something here*
EndSwitch
WEnd

and also

While 1
$nmsg = GUIGetMsg()
Switch $nmsg
Case $button1

EndSwitch
WEnd

it may contradict the first function and instead tell the program to do nothing.

Link to comment
Share on other sites

Please clarify, did YOU make an x button and you want it to be the new exit button or are you referring to the original GUI x button? If you made one just do

While 1
$nmsg = GUIGetMsg()
Switch $nmsg
Case $buttonname
Exit
EndSwitch
WEnd
Edited by dbzfanatic
Link to comment
Share on other sites

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        EndSwitch
WEnd

won't work?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...