mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-04 06:46:23 +00:00
fix #135 by making onPlayerDisconnect blocking, and calling it before removing the player
before, the handlers were not waited for, so the client was usually destructed before lua got to the actual event handler call. Now, the handler is called and waited on, and once all handlers are done, the client is properly removed from the players internally, thus making calls to GetPlayerName, GetPlayerIdentifiers, etc. return nil etc.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <optional>
|
||||
|
||||
void TClient::DeleteCar(int Ident) {
|
||||
// TODO: Send delete packets
|
||||
std::unique_lock lock(mVehicleDataMutex);
|
||||
auto iter = std::find_if(mVehicleData.begin(), mVehicleData.end(), [&](auto& elem) {
|
||||
return Ident == elem.ID();
|
||||
|
||||
Reference in New Issue
Block a user