mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-08-16 08:16:09 +00:00
Prevent lua sending client events during downloading (#431)
This PR fixes an issue where players would get personal events during downloads, which would corrupt the download and block the user from being able to properly join the server. --- By creating this pull request, I understand that code that is AI generated or otherwise automatically generated may be rejected without further discussion. I declare that I fully understand all code I pushed into this PR, and wrote all this code myself and own the rights to this code.
This commit is contained in:
commit
40bd050ca6
@ -148,6 +148,11 @@ static inline std::pair<bool, std::string> InternalTriggerClientEvent(int Player
|
|||||||
return { false, "Invalid Player ID" };
|
return { false, "Invalid Player ID" };
|
||||||
}
|
}
|
||||||
auto c = MaybeClient.value().lock();
|
auto c = MaybeClient.value().lock();
|
||||||
|
|
||||||
|
if (!c->IsSyncing() && !c->IsSynced()) {
|
||||||
|
return { false, "Player hasn't joined yet" };
|
||||||
|
}
|
||||||
|
|
||||||
if (!LuaAPI::MP::Engine->Network().Respond(*c, StringToVector(Packet), true)) {
|
if (!LuaAPI::MP::Engine->Network().Respond(*c, StringToVector(Packet), true)) {
|
||||||
beammp_lua_errorf("Respond failed, dropping client {}", PlayerID);
|
beammp_lua_errorf("Respond failed, dropping client {}", PlayerID);
|
||||||
LuaAPI::MP::Engine->Network().ClientKick(*c, "Disconnected after failing to receive packets");
|
LuaAPI::MP::Engine->Network().ClientKick(*c, "Disconnected after failing to receive packets");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user