1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-04 21:49:40 +00:00

[Server] Remove result from the OnPlayerConnect callback

Now it's recommended to use tes3mp.Kick() function
This commit is contained in:
Koncord 2018-10-30 13:18:32 +08:00
parent f1e8569291
commit 20a7619a4a
2 changed files with 4 additions and 5 deletions

View file

@ -140,11 +140,10 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{ {
player->setLoadState(Player::LOADED); player->setLoadState(Player::LOADED);
static constexpr unsigned int ident = Script::CallbackIdentity("OnPlayerConnect"); unsigned short pid = Players::getPlayer(packet->guid)->getId();
Script::CallBackReturn<ident> result = true; Script::Call<Script::CallbackIdentity("OnPlayerConnect")>(pid);
Script::Call<ident>(result, Players::getPlayer(packet->guid)->getId());
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)->setPlayer(Players::getPlayer(packet->guid));
playerPacketController->GetPacket(ID_USER_DISCONNECTED)->Send(false); playerPacketController->GetPacket(ID_USER_DISCONNECTED)->Send(false);

View file

@ -153,7 +153,7 @@ public:
{"OnServerInit", Function<void>()}, {"OnServerInit", Function<void>()},
{"OnServerPostInit", Function<void>()}, {"OnServerPostInit", Function<void>()},
{"OnServerExit", Function<void, bool>()}, {"OnServerExit", Function<void, bool>()},
{"OnPlayerConnect", Function<bool, unsigned short>()}, {"OnPlayerConnect", Function<void, unsigned short>()},
{"OnPlayerDisconnect", Function<void, unsigned short>()}, {"OnPlayerDisconnect", Function<void, unsigned short>()},
{"OnPlayerDeath", Function<void, unsigned short>()}, {"OnPlayerDeath", Function<void, unsigned short>()},
{"OnPlayerResurrect", Function<void, unsigned short>()}, {"OnPlayerResurrect", Function<void, unsigned short>()},