Fix: Multilogin

If you want to help us or give some corrections / codes, put it here ;)

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Fix: Multilogin

Postby core on Sun Oct 21, 2007 1:49 pm

Fixed multilogin now - only one line of the previous fix in charserver had to be editted.
Remember: It is not working with an autorestarting charserver.

LoginServer: LoginPackets.cpp
replace the re-login part of pakUserLogin with:
  1.            if(atoi(row[4])==1)
  2.             {
  3.                 // Activation Fix By Rifke
  4.                 Log( MSG_INFO, "Success login '%s' : Account verfified.", thisclient->username.c_str() );
  5.                 if(atoi(row[3])==1)
  6.                 {   // characters is already logged
  7.                     Log(MSG_WARNING, "Account %s try re-login", thisclient->username.c_str() );
  8.                     ADDBYTE( pak, 4 );
  9.                     ADDDWORD( pak, 0 );        
  10.                     thisclient->SendPacket( &pak );
  11.                     DB->QFree( );
  12.                     DB->QExecute( "update accounts set online=0 WHERE username='%s'", thisclient->username.c_str());                
  13.                        BEGINPACKET( pak2, 0x502 );
  14.                        ADDBYTE    ( pak2, 1 );
  15.                        ADDDWORD   ( pak2, atoi(row[0]) );
  16.                       cryptPacket( (char*)&pak2, NULL );              
  17.                     for(UINT i=0;i<ServerList.size();i++)
  18.                         send( ServerList.at(i)->sock , (char*)&pak2, pak2.Size, 0 );
  19.                        
  20.                     return false;                
  21.                 }

CharServer: charpackets.cpp
replace pakLoginDSClient with:
  1. // Disconnect client from char/world server
  2. bool CCharServer::pakLoginDSClient( CCharClient* thisclient, CPacket* P )
  3. {
  4.     unsigned int userid = GETDWORD((*P), 1 );
  5.     CCharClient* otherclient = GetClientByUserID( userid );
  6.     BYTE action = GETBYTE((*P),0);
  7.     switch(action)
  8.     {
  9.         case 1:
  10.         {            
  11.             if(otherclient==NULL)
  12.             {
  13.                 Log( MSG_WARNING, "Userid '%u' is not online", userid );
  14.                 return true;
  15.             }
  16.             otherclient->isLoggedIn = false;
  17.             otherclient->isActive = false;
  18.             BEGINPACKET( pak, 0x502 );
  19.             ADDBYTE    ( pak, 1 );
  20.             ADDDWORD   ( pak, userid );
  21.             //ADDBYTE    ( pak, 0x00 );
  22.             cryptPacket( (char*)&pak, NULL );
  23.             CChanels* thischannel = GetChannelByID( otherclient->channel );
  24.             if(thischannel!=NULL)
  25.                 send( thischannel->sock, (char*)&pak, pak.Size, 0 );
  26.         }
  27.         break;
  28.     }
  29.     return true;
  30. }

WorldServer: worldackets.cpp
replace pakCharDSClient with:
  1. // Disconnect char
  2. bool CWorldServer::pakCharDSClient( CPlayer* thisclient, CPacket* P )
  3. {
  4.     unsigned int userid = GETDWORD((*P), 1 );              
  5.     CPlayer* otherclient = GetClientByUserID( userid );
  6.     if(otherclient==NULL) return true;
  7.    
  8.     BYTE action = GETBYTE((*P),0);
  9.     switch(action)
  10.     {
  11.         case 1:
  12.         {
  13.             if(otherclient==NULL)
  14.             {
  15.                 Log(MSG_WARNING, "userid '%s' not found online", userid );
  16.                 return true;
  17.             }
  18.  
  19.             BEGINPACKET( pak, 0x707 );
  20.             ADDWORD( pak, 0 );
  21.             otherclient->client->SendPacket( &pak );
  22.  
  23.             otherclient->client->isActive = false;                              
  24.         }
  25.         break;
  26.     }    
  27.     return true;    
  28. }
Image
User avatar
core
Pomic
Pomic
 
Posts: 126
Joined: Thu Aug 09, 2007 5:47 pm

Re: Fix: Multilogin

Postby Poseidon on Thu Oct 25, 2007 8:58 am

Most servers use the auto restarter softwares that members share with others.

This code could be useful if the server was 100% crash free. Maybe we can tweak it a little :?:
User avatar
Poseidon
Moderator
Moderator
 
Posts: 302
Joined: Thu Aug 09, 2007 5:02 am

Re: Fix: Multilogin

Postby lmame on Thu Oct 25, 2007 9:09 am

It seems also this could cause "You are already logged in" if you click on "character select" in game, then Exit (from the place in the tree), but that's a start.
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: Fix: Multilogin

Postby core on Thu Oct 25, 2007 2:59 pm

The char and loginserver don't need an autorestarter because they almost never crash. The worldserver can be restarted like before without any problems. We disabled charselect on our server due to prior problems with disconnects, so we didn't test this modification with charselect.
Image
User avatar
core
Pomic
Pomic
 
Posts: 126
Joined: Thu Aug 09, 2007 5:47 pm

Re: Fix: Multilogin

Postby austrasized on Mon Mar 03, 2008 8:46 am

Now, I know this could possibly be a noob question here....But, I wanted this to be clear for everyone that might stumble in here. What does this exactly fix? stopping the same account from logging on twice? stopping multi-client users that run say a buff-bot account ex. play one acct soldier char dif acct buffer char? or what exactly? Like I said nooby, but I would like cleared up for everyone pleasy.
austrasized
Little soul
Little soul
 
Posts: 6
Joined: Fri Feb 29, 2008 8:27 pm

Re: Fix: Multilogin

Postby Jckf on Mon Mar 03, 2008 9:00 am

austrasized wrote:Now, I know this could possibly be a noob question here....But, I wanted this to be clear for everyone that might stumble in here. What does this exactly fix? stopping the same account from logging on twice? stopping multi-client users that run say a buff-bot account ex. play one acct soldier char dif acct buffer char? or what exactly? Like I said nooby, but I would like cleared up for everyone pleasy.

This patch removes the possibility of logging in twice with the same account.
User avatar
Jckf
Antares
Antares
 
Posts: 338
Joined: Wed Nov 28, 2007 1:09 am
Location: Norway

Re: Fix: Multilogin

Postby austrasized on Sun May 24, 2009 8:02 am

sry to bump back so long thx though jckf
austrasized
Little soul
Little soul
 
Posts: 6
Joined: Fri Feb 29, 2008 8:27 pm

Re: Fix: Multilogin

Postby redgie on Sat May 15, 2010 4:11 am

just to check is this the codes to stop dual clients?
redgie
Rackie
Rackie
 
Posts: 267
Joined: Tue Apr 14, 2009 10:03 am

Re: Fix: Multilogin

Postby xPrend on Sat May 15, 2010 10:12 am

Nope
User avatar
xPrend
Antares
Antares
 
Posts: 346
Joined: Fri Jul 17, 2009 9:22 am


Return to Submit Code

Who is online

Users browsing this forum: No registered users and 2 guests