diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 7255eb766..6d2353956 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -140,11 +140,10 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) { player->setLoadState(Player::LOADED); - static constexpr unsigned int ident = Script::CallbackIdentity("OnPlayerConnect"); - Script::CallBackReturn result = true; - Script::Call(result, Players::getPlayer(packet->guid)->getId()); + unsigned short pid = Players::getPlayer(packet->guid)->getId(); + Script::Call(pid); - if (!result) + if (player->getLoadState() == Player::KICKED) // kicked inside in OnPlayerConnect { playerPacketController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(Players::getPlayer(packet->guid)); playerPacketController->GetPacket(ID_USER_DISCONNECTED)->Send(false); diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index 7cebe7592..dc32770a3 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -153,7 +153,7 @@ public: {"OnServerInit", Function()}, {"OnServerPostInit", Function()}, {"OnServerExit", Function()}, - {"OnPlayerConnect", Function()}, + {"OnPlayerConnect", Function()}, {"OnPlayerDisconnect", Function()}, {"OnPlayerDeath", Function()}, {"OnPlayerResurrect", Function()},