Fix postPlayerAuth not running until after leaving

This commit is contained in:
Tixx 2024-11-25 00:33:10 +01:00
parent 1c07cf83b2
commit 99a51808a0
No known key found for this signature in database
GPG Key ID: EC6E7A2BAABF0B8C

View File

@ -430,15 +430,9 @@ std::shared_ptr<TClient> TNetwork::Authentication(TConnection&& RawConnection) {
Reason = "No guests are allowed on this server! To join, sign up at: forum.beammp.com."; Reason = "No guests are allowed on this server! To join, sign up at: forum.beammp.com.";
} }
if (!NotAllowed && !NotAllowedWithReason) { if (!NotAllowed && !NotAllowedWithReason && mServer.ClientCount() >= size_t(Application::Settings.getAsInt(Settings::Key::General_MaxPlayers)) && !BypassLimit) {
if (mServer.ClientCount() < size_t(Application::Settings.getAsInt(Settings::Key::General_MaxPlayers)) || BypassLimit) {
beammp_info("Identification success");
mServer.InsertClient(Client);
TCPClient(Client);
} else {
NotAllowedWithReason = true; NotAllowedWithReason = true;
Reason = "Server full!"; Reason = "Server full!";
}
} }
if (NotAllowedWithReason) { if (NotAllowedWithReason) {
@ -451,6 +445,12 @@ std::shared_ptr<TClient> TNetwork::Authentication(TConnection&& RawConnection) {
// the post event is not cancellable so we dont wait for it // the post event is not cancellable so we dont wait for it
LuaAPI::MP::Engine->ReportErrors(PostFutures); LuaAPI::MP::Engine->ReportErrors(PostFutures);
if (!NotAllowed && !NotAllowedWithReason) {
beammp_info("Identification success");
mServer.InsertClient(Client);
TCPClient(Client);
}
return Client; return Client;
} }