Remember: It is not working with an autorestarting charserver.
LoginServer: LoginPackets.cpp
replace the re-login part of pakUserLogin with:
- if(atoi(row[4])==1)
- {
- // Activation Fix By Rifke
- Log( MSG_INFO, "Success login '%s' : Account verfified.", thisclient->username.c_str() );
- if(atoi(row[3])==1)
- { // characters is already logged
- Log(MSG_WARNING, "Account %s try re-login", thisclient->username.c_str() );
- ADDBYTE( pak, 4 );
- ADDDWORD( pak, 0 );
- thisclient->SendPacket( &pak );
- DB->QFree( );
- DB->QExecute( "update accounts set online=0 WHERE username='%s'", thisclient->username.c_str());
- BEGINPACKET( pak2, 0x502 );
- ADDBYTE ( pak2, 1 );
- ADDDWORD ( pak2, atoi(row[0]) );
- cryptPacket( (char*)&pak2, NULL );
- for(UINT i=0;i<ServerList.size();i++)
- send( ServerList.at(i)->sock , (char*)&pak2, pak2.Size, 0 );
- return false;
- }
CharServer: charpackets.cpp
replace pakLoginDSClient with:
- // Disconnect client from char/world server
- bool CCharServer::pakLoginDSClient( CCharClient* thisclient, CPacket* P )
- {
- unsigned int userid = GETDWORD((*P), 1 );
- CCharClient* otherclient = GetClientByUserID( userid );
- BYTE action = GETBYTE((*P),0);
- switch(action)
- {
- case 1:
- {
- if(otherclient==NULL)
- {
- Log( MSG_WARNING, "Userid '%u' is not online", userid );
- return true;
- }
- otherclient->isLoggedIn = false;
- otherclient->isActive = false;
- BEGINPACKET( pak, 0x502 );
- ADDBYTE ( pak, 1 );
- ADDDWORD ( pak, userid );
- //ADDBYTE ( pak, 0x00 );
- cryptPacket( (char*)&pak, NULL );
- CChanels* thischannel = GetChannelByID( otherclient->channel );
- if(thischannel!=NULL)
- send( thischannel->sock, (char*)&pak, pak.Size, 0 );
- }
- break;
- }
- return true;
- }
WorldServer: worldackets.cpp
replace pakCharDSClient with:
- // Disconnect char
- bool CWorldServer::pakCharDSClient( CPlayer* thisclient, CPacket* P )
- {
- unsigned int userid = GETDWORD((*P), 1 );
- CPlayer* otherclient = GetClientByUserID( userid );
- if(otherclient==NULL) return true;
- BYTE action = GETBYTE((*P),0);
- switch(action)
- {
- case 1:
- {
- if(otherclient==NULL)
- {
- Log(MSG_WARNING, "userid '%s' not found online", userid );
- return true;
- }
- BEGINPACKET( pak, 0x707 );
- ADDWORD( pak, 0 );
- otherclient->client->SendPacket( &pak );
- otherclient->client->isActive = false;
- }
- break;
- }
- return true;
- }