-2

I am currently working on a server manager for the game DayZ. I have almost 90 % done, I have a working history of servers joined etc. I'm working on a option where the game will launch with a click of a button, which works, but i need it to connect to the server without the person having to go through all the steps.

I know the launch parameters to do so, the issue is I have to be able to let the people put in the launch parameter and then for my code to be dynamic and pickup any legit parameter for joining servers. (example: -connect=109.95.211.243 -port=2502), so I have two text boxes for them to use, but now I need my button to execute the game with those dynamic parameters.

Sorry if this is a bit confusing

Current code,

    Dim pHelp As New ProcessStartInfo

    pHelp.FileName = "C:\Program Files (x86)\Steam\SteamApps\common\DayZ\DayZ.exe"

    pHelp.Arguments =

    pHelp.UseShellExecute = True

    pHelp.WindowStyle = ProcessWindowStyle.Normal

    Dim proc As Process = Process.Start(pHelp)
Abdur Rahman
  • 353
  • 5
  • 16

1 Answers1

0

You just have to read the values of the text boxes or dropdowns or whatever control you have and put them in the arguments string:

pHelp.Arguments = "-connect=" + textBoxIP.Text + " -port=" + textBoxPort.Text;

Note that you might want to test the actual values whether they're valid before.

Mario
  • 35,726
  • 5
  • 62
  • 78
  • the values work, as i tested them by putting in a legit ip and port, so if this works then God bless lol – Elijah Thompson Mar 14 '15 at 18:52
  • @ElijahThompson You misunderstood me. You should verify that the user input is valid, i.e. that the data is legitimate. – Mario Mar 14 '15 at 22:33
  • well either or, it worked so thank you, next thing i got to work on is being able to save the list that the severs show up on, and be able to view the servers without being in the game, which only one program i know of can do and im not sure how, but thanks – Elijah Thompson Mar 14 '15 at 23:28