Sign in to follow this  
Followers 0
Prodigy

Call Of Duty 2 Connecter (Open for Suggestions)

22 posts in this topic

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,

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Ow and i have another question, when i add A background image with guictrlcreatepic, my buttons don't work anymore.

Any help is welcome

Edited by Prodigy

Share this post


Link to post
Share on other sites

I take it you don't like X-Fire?

Share this post


Link to post
Share on other sites

Yeah i do like xfire but every time i start it up my internet connection disconnects.

+ I'ts way faster with my little script.

So does any one know why i cant use my buttons?

Share this post


Link to post
Share on other sites

i think you must first create the pic and then the buttons in order to work

Share this post


Link to post
Share on other sites

I put guictrlcreatepic right after guicreate.

So i dont think thats the problem

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

What's a Koda?

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Add this in after the GUICtrlCreatePic();

GUICtrlSetState(-1, $GUI_DISABLE)

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Thanks a lot AzKay.

You too dbzfanatic (pretty cool this koda thingy)

Share this post


Link to post
Share on other sites

Yeah it's Waaay faster.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Prodigy play cod on EsM servers :)

Share this post


Link to post
Share on other sites

btw does any one know to enable the X button that it actually exits?

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

I'm referring to the original GUI x button

Share this post


Link to post
Share on other sites

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

won't work?

Share this post


Link to post
Share on other sites

k, thanks a lot

Share this post


Link to post
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
Sign in to follow this  
Followers 0