• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help pleas someone Edit my Code
#1
Hi
i use this code for Bind hotkey (F1) to connect to the server.
to work this code i have to run my game with this parameter:

iw5mp.exe +server 192.168.137.1:27017

But i want to run Game without this parameters and i need to edit this code
so i want to Add ip and port into this code so there is no need to GetCommandLineA() in this lin:

C++ Code
  1. char * cmdline = (char *)GetCommandLineA();


But i dont know how can i do this may i pleased someone do that for me.
i will very Thanks from he/she.

C++ Code
  1. if (vKey == VK_F1)
  2. {
  3. Console(0, V("connect_extF1\n\n"));
  4. }
  5.  
  6. if (strncmp(command, V("connect_extF1"), 11) == 0)
  7. {
  8. char * cmdline = (char *)GetCommandLineA();
  9. char *server = strstr(cmdline, V("+server "));
  10. if (server == NULL)
  11. {
  12. info("ERROR: +server commandline param not found.");
  13. return 0;
  14. }
  15.  
  16. ServerList* pList = ServerList::getInstance();
  17. if (pList == NULL)
  18. {
  19. info("ERROR: Unable to get ServerList instance!");
  20. return 0;
  21. }
  22.  
  23. char connect_cmd[255];
  24.  
  25. DWORD ip = 0;
  26. USHORT port = 0;
  27. char ip_str[255];
  28.  
  29. if (parseIpPort(server+8, &ip, &port))
  30. {
  31. makeIPstr(ip, ip_str);
  32.  
  33. sprintf(connect_cmd, V("connect %s:%d\n"), ip_str, port);
  34.  
  35. #ifdef DEBUGGING_ENABLED
  36. info("ip %08X port %04X ->> console cmd will be: %s", ip, port, connect_cmd);
  37. #endif
  38.  
  39.  
  40. void * blob = pList->createConnectionBlob(htonl(ip), port, false);
  41. pList->startConnBlobLoaderThread(blob);
  42.  
  43. return tramp(unk, connect_cmd);
  44. }
  45. else
  46. {
  47. info("ERROR: Invalid 'server' command line value. Required format: +server ip:netport");
  48. return 0;
  49. }
  50. }
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Mep Edit coordinance raminr63 2 1,286 10-22-2013, 15:02
Last Post: Yamato
  Help Code color crosshairs koren30 3 1,678 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 3,191 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 1,415 08-27-2013, 18:18
Last Post: tubwux
Information Help How to edit new derived entry? (Solved) SSonic70 1 939 08-20-2013, 15:29
Last Post: Nekochan
  [Request] Compile this code please dozsa0 4 1,697 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 3,610 08-08-2013, 14:53
Last Post: Bandarigoda123
  [Release] MOSSY v9.12 Re-edit by BloKK187 BloKK187 24 22,973 08-05-2013, 23:44
Last Post: TheWraith10219
  Compile please this code First_Semyon 8 2,225 07-28-2013, 01:52
Last Post: First_Semyon
  [Request] Edit BOloader 0.8 Bot settings IgnaBmx 2 1,452 06-30-2013, 02:35
Last Post: IgnaBmx

Forum Jump:


Users browsing this thread: 1 Guest(s)