[Server] Remove result from the OnPlayerConnect callback

Now it's recommended to use tes3mp.Kick() function
pull/484/head
Koncord 6 years ago
parent f1e8569291
commit 20a7619a4a

@ -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);

@ -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>()},

Loading…
Cancel
Save