• 0
DarkOne

Fix Source: Kick after selecting character 40k

Question

Ok after much searching I found a work around for when a person logs into your server and they select a character and then gets returned to the selection screen. I was using a Loopback Adapter to resolve this but you had to use portmap to make it work fully. Here is a semi fix "but working" You do not have to add anything in your Config files just change this in your source and compile and no need for portmap. Credit go to  rawn3cr0 for this fix

In desc_client.cpp:

if (!bSentBoot)
               {
                  bSentBoot = true;
                  TPacketGDBoot p;
                  p.dwItemIDRange[0] = 0;
                  p.dwItemIDRange[1] = 0;
                  memcpy(p.szIP, g_szPublicIP, 16);
                  DBPacket(HEADER_GD_BOOT, 0, &p, sizeof(p));
               }
            }

            TEMP_BUFFER buf;

            TPacketGDSetup p;

            memset(&p, 0, sizeof(p));
            strlcpy(p.szPublicIP, g_szPublicIP, sizeof(p.szPublicIP));

  Change in:

if (!bSentBoot)
               {
                  bSentBoot = true;
                  TPacketGDBoot p;
                  p.dwItemIDRange[0] = 0;
                  p.dwItemIDRange[1] = 0;
                  memcpy(p.szIP, "External IP", 16);
                  DBPacket(HEADER_GD_BOOT, 0, &p, sizeof(p));
               }
            }

            TEMP_BUFFER buf;

            TPacketGDSetup p;

            memset(&p, 0, sizeof(p));
            strlcpy(p.szPublicIP, "External IP", sizeof(p.szPublicIP));

Where the External IP, modified with your external IP address

if (!bSentBoot)
               {
                  bSentBoot = true;
                  TPacketGDBoot p;
                  p.dwItemIDRange[0] = 0;
                  p.dwItemIDRange[1] = 0;
                  memcpy(p.szIP, "109.197.24.321", 16);
                  DBPacket(HEADER_GD_BOOT, 0, &p, sizeof(p));
               }
            }

            TEMP_BUFFER buf;

            TPacketGDSetup p;

            memset(&p, 0, sizeof(p));
            strlcpy(p.szPublicIP, "109.197.24.321", sizeof(p.szPublicIP));

  

  • Like 1

Share this post


Link to post
Share on other sites

13 answers to this question

  • 0

Here is another method of fixing the same problem. With this method, one can change the ip in the config files.Both of these methods take like 30 secs or so to show a connection after starting the server. So lets begin.

 

In Config Auth,Ch's,Game99 Use

CONNECTION_IP: Your Wan IP

Game\config.cpp

Go to line 56 and add:

char        g_ipfix[16] = "0";

Go to the 1169 line and add:
 

TOKEN("connection_ip")
     {
       strlcpy(g_ipfix, value_string, sizeof(g_ipfix));
     }

Game \ config.h

Go to line 56 and add:

extern char     g_ipfix[16];

Game\desc_client.cpp

Go to line 149 and replace:

memcpy(p.szIP, g_szPublicIp, 16);

with:

memcpy(p.szIP, g_ipfix, 16);

Go to line 159 and replace:

strlcpy (p.szPublicIP, g_szPublicip, sizeof (p.szPublicIP));

with:

strlcpy(p.szPublicIP, g_ipfix, sizeof(p.szPublicIP));

Compile and your done. Just put CONNECTION_IP: Your Wan IP in your configs and your done.

Credit goes to Arves100

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Ok, I fixed the delay in connecting using this method. I had my configs with localhost in all config files. I changed it to 127.0.0.1 and now it loads fine. No more delays when server first starts.

Share this post


Link to post
Share on other sites
  • 0
On 18/1/2017 at 8:14 AM, DarkOne said:

Here is another method of fixing the same problem. With this method, one can change the ip in the config files.Both of these methods take like 30 secs or so to show a connection after starting the server. So lets begin.

 

In Config Auth,Ch's,Game99 Use

CONNECTION_IP: Your Wan IP

Game\config.cpp

Go to line 56 and add:


char        g_ipfix[16] = "0";

Go to the 1169 line and add:
 


TOKEN("connection_ip")
     {
       strlcpy(g_ipfix, value_string, sizeof(g_ipfix));
     }

Game \ config.h

Go to line 56 and add:


extern char     g_ipfix[16];

Game\desc_client.cpp

Go to line 149 and replace:


memcpy(p.szIP, g_szPublicIp, 16);

with:


memcpy(p.szIP, g_ipfix, 16);

Go to line 159 and replace:


strlcpy (p.szPublicIP, g_szPublicip, sizeof (p.szPublicIP));

with:


strlcpy(p.szPublicIP, g_ipfix, sizeof(p.szPublicIP));

Compile and your done. Just put CONNECTION_IP: Your Wan IP in your configs and your done.

Credit goes to Arves100

Wow, maybe the first "fix" i made for Metin2

So much time passed...

 

Anyway : i just created a new variable called g_ipfix witch incredibily it's the same as g_szPublicip.

Translation: use PUBLIC_IP rather than CONNECTION_IP or the source edit.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

I've tried both methods and every time the client stucks at "connecting to the server". The sysser on the server is clear, there are no errors. I've also opened the ports: 11002, 13000 , 13001 , 13099 , 13061 , 13002 , 13003 , 13004 , 14099 , 14051 , 14041 , 14031 , 3306 , 22 , 40250. I use the fliege serverfiles.

Share this post


Link to post
Share on other sites
  • 0
On 10/23/2017 at 4:59 AM, monarchis2 said:

Does this work with hamachi?

Uses WAN IP. No need for hamachi....

On 11/8/2017 at 4:54 PM, Calypso said:

Does not work with Hamachi. Game 40250 with portmap..

My friend can not join the server with my IP Hamachi .. Disconned after character select..

No need for portmap or hamachi

Share this post


Link to post
Share on other sites
  • 0

HEllo everyone i have problem with connect in game after select character i got kick (40k) i just change in source and binnary source this:

Serverside: desc_client.cpp

if (!bSentBoot)
{
bSentBoot = true;
TPacketGDBoot p;
p.dwItemIDRange[0] = 0;
p.dwItemIDRange[1] = 0;
memcpy(p.szIP, "My IP", 16);
DBPacket(HEADER_GD_BOOT, 0, &p, sizeof(p));
}
}

TEMP_BUFFER buf;

TPacketGDSetup p;

memset(&p, 0, sizeof(p));
strlcpy(p.szPublicIP, "My IP", sizeof(p.szPublicIP));
Clientside: NetAddress.cpp


void CNetworkAddress::GetIP(char* szIP, int len)
{
BYTE IPs[4];
*((DWORD*)IPs)=m_sockAddrIn.sin_addr.s_addr;

_snprintf(szIP, len, "My IP", IPs[0], IPs[1], IPs[2], IPs[3]);

This is fix for select kick and dont work sysser (game1) written :
SYSERR: Dec 6 01:21:37 :: socket_connect: HOST MyIP:14011, could not connect.
I allow ports i dont understand please someone help me

Share this post


Link to post
Share on other sites
  • 0

you change where says My IP?

Clientside: NetAddress.cpp


void CNetworkAddress::GetIP(char* szIP, int len)
{
BYTE IPs[4];
*((DWORD*)IPs)=m_sockAddrIn.sin_addr.s_addr;

_snprintf(szIP, len, "My IP", IPs[0], IPs[1], IPs[2], IPs[3]);



On "My IP" you put your external IP (The ip of your internet expl: "4.131.32.214")....
 

void CNetworkAddress::GetIP(char* szIP, int len)
{
BYTE IPs[4];
*((DWORD*)IPs)=m_sockAddrIn.sin_addr.s_addr;

_snprintf(szIP, len, "4.131.32.214", IPs[0], IPs[1], IPs[2], IPs[3]);

 

  • Thanks 1

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

  • Recently Browsing   0 members

    No registered users viewing this page.