From 86b37e8ae155b2743c43d59ea90ebd09c2e4a207 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Wed, 18 Sep 2024 16:23:50 +0200 Subject: [PATCH] move postPlayerAuth later again, after client insert --- src/TNetwork.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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; }