Wise
09-03-18, 10:22 AM
Script that can help stop multiple logins per IP Address.
I am not the developer of this script
, I'm just sharing this line of code with everyone that wants to use it on their server, if they so choose.
This script will only work on any revision after (7240faf), which was committed on June 21st, 2014. Some edits might be required, so keep that in mind.
Notice
: Players are still able to login to the character screen with this, but not the world. After the player(s) hit the "Enter World" button, they will be disconnected on that secondary account.
/***
* @project: Firestorm Freelance
* @author: Meltie2013 (github) aka Lilcrazy
* @copyright: 2017
*/
#include "ScriptMgr.h"
#include "World.h"
#include "WorldSession.h"
// Check to see if the player is attempting to multi-box
class multi_login_check : public PlayerScript
{
public:
multi_login_check() : PlayerScript("multi_login_check") { }
void OnLogin(Player* player, bool /*firstLogin*/) override
{
SessionMap sessions = sWorld->GetAllSessions();
for (SessionMap::iterator itr = sessions.begin(); itr != sessions.end(); ++itr)
{
if (Player* login = itr->second->GetPlayer())
{
if (player != login)
{
// If Remote Address matches, remove the player from the world
if (player->GetSession()->GetRemoteAddress() == login->GetSession()->GetRemoteAddress())
player->GetSession()->KickPlayer();
}
}
}
}
};
void AddSC_player_session_checks()
{
new multi_login_check;
}
I am not the developer of this script
, I'm just sharing this line of code with everyone that wants to use it on their server, if they so choose.
This script will only work on any revision after (7240faf), which was committed on June 21st, 2014. Some edits might be required, so keep that in mind.
Notice
: Players are still able to login to the character screen with this, but not the world. After the player(s) hit the "Enter World" button, they will be disconnected on that secondary account.
/***
* @project: Firestorm Freelance
* @author: Meltie2013 (github) aka Lilcrazy
* @copyright: 2017
*/
#include "ScriptMgr.h"
#include "World.h"
#include "WorldSession.h"
// Check to see if the player is attempting to multi-box
class multi_login_check : public PlayerScript
{
public:
multi_login_check() : PlayerScript("multi_login_check") { }
void OnLogin(Player* player, bool /*firstLogin*/) override
{
SessionMap sessions = sWorld->GetAllSessions();
for (SessionMap::iterator itr = sessions.begin(); itr != sessions.end(); ++itr)
{
if (Player* login = itr->second->GetPlayer())
{
if (player != login)
{
// If Remote Address matches, remove the player from the world
if (player->GetSession()->GetRemoteAddress() == login->GetSession()->GetRemoteAddress())
player->GetSession()->KickPlayer();
}
}
}
}
};
void AddSC_player_session_checks()
{
new multi_login_check;
}