diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index e6d0163..986f5bb 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -437,15 +437,10 @@ std::shared_ptr TNetwork::Authentication(TConnection&& RawConnection) { ClientKick(*Client, Reason); } - auto PostFutures = LuaAPI::MP::Engine->TriggerEvent("postPlayerAuth", "", Allowed, Client->GetName(), Client->GetRoles(), Client->IsGuest(), Client->GetIdentifiers()); - // the post event is not cancellable so we dont wait for it - LuaAPI::MP::Engine->ReportErrors(PostFutures); if (!Allowed) { return {}; - } - - if (mServer.ClientCount() < size_t(Application::Settings.getAsInt(Settings::Key::General_MaxPlayers))) { + } else if (mServer.ClientCount() < size_t(Application::Settings.getAsInt(Settings::Key::General_MaxPlayers))) { beammp_info("Identification success"); mServer.InsertClient(Client); TCPClient(Client); @@ -453,6 +448,10 @@ std::shared_ptr TNetwork::Authentication(TConnection&& RawConnection) { ClientKick(*Client, "Server full!"); } + auto PostFutures = LuaAPI::MP::Engine->TriggerEvent("postPlayerAuth", "", Allowed, Client->GetName(), Client->GetRoles(), Client->IsGuest(), Client->GetIdentifiers()); + // the post event is not cancellable so we dont wait for it + LuaAPI::MP::Engine->ReportErrors(PostFutures); + return Client; }