Jump to content

Doubt CheckClientVersion Source mainline


Recommended Posts

config.cpp

bool        g_bCheckClientVersion = true; // activated function
string    g_stClientVersion = "1215955205"; // key
void CheckClientVersion()
{
    if (LC_IsEurope())
    {
        g_bCheckClientVersion = true;
    }
    else
    {
        g_bCheckClientVersion = false;
    }

    const DESC_MANAGER::DESC_SET & set = DESC_MANAGER::instance().GetClientSet();
    DESC_MANAGER::DESC_SET::const_iterator it = set.begin();

    while (it != set.end())
    {
        LPDESC d = *(it++);

        if (!d->GetCharacter())
            continue;


        int version = atoi(g_stClientVersion.c_str());
        int date    = atoi(d->GetClientVersion() );

        //if (0 != g_stClientVersion.compare(d->GetClientVersion()) )
        if (version > date)
        {
            d->GetCharacter()->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("Ŭ¶óÀ̾ðÆ® ¹öÀüÀÌ Æ²·Á ·Î±×¾Æ¿ô µË´Ï´Ù. Á¤»óÀûÀ¸·Î ÆÐÄ¡ ÈÄ Á¢¼ÓÇϼ¼¿ä."));
            d->DelayedDisconnect(10);
        }
    }
}

what it takes to CheckClientVersion fix ?

"Some come to see you fall, others come pick you up
Some come make you smile, others will make you cry
Some lie by lie, lie to deceive others "

 

Link to comment
Share on other sites

  • Developer

If you read the code, you'll see two integers, version and date, which are equal to the client version and the g_stClientVersion string, so if the string is bigger than the client version, it'll print that text and disconnect the character in 10 seconds.
What I've done to "fix" it, is change the > to !=, so if both versions are different, it'll always disconnect the character.

  • Love 1

when you return 0 and server doesn't boot:

unknown.png

Link to comment
Share on other sites

Still that won't work.

It'll not disconnect you. You have to change some more.

 

    if (LC_IsEurope())
    {
        g_bCheckClientVersion = true;
    }
    else
    {
        g_bCheckClientVersion = false;
    }
 
This should be removed. Makes sure you always check the version even when you don't use Europe locale.
 
Next, I've changed the check variables to char* so the server won't have to convert the versions into integers (which may overflow and result into false values). It'll just use char's instead. You can compare them with strcmp. This version works fine (tested on my vanilla core).
  • Love 1

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

thanks Vanilla

Variable which have to char, you can leave example?

char        g_bCheckClientVersion = true; // função ativada false desativa
string    g_stClientVersion = "1215955205"; // "1215955205" chave -key

well?

"Some come to see you fall, others come pick you up
Some come make you smile, others will make you cry
Some lie by lie, lie to deceive others "

 

Link to comment
Share on other sites

No, don't do this.

If you're using true or false for a variable, then always use bool.

 

bool        g_bCheckClientVersion = true; // função ativada false desativa
const char*    g_stClientVersion = "1215955205"; // "1215955205" chave -key
 
const char* will do the trick. Make it constant since you won't have to change the version in your code. It keeps as it is.
And if you're using char* you won't need atoi anymore.

 

  • Love 1

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.