add back car deletion

This commit is contained in:
Lion Kortlepel 2024-09-18 16:46:11 +02:00
parent 0cc73e70c9
commit 3068a0e5c4
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B
2 changed files with 2 additions and 1 deletions

View File

@ -657,6 +657,8 @@ void TNetwork::OnDisconnect(const std::weak_ptr<TClient>& ClientPtr) {
} // End Vehicle Data Lock Scope
for (auto& v : VehicleData) {
LuaAPI::MP::Engine->ReportErrors(LuaAPI::MP::Engine->TriggerEvent("onVehicleDeleted", "", c.GetID(), v.ID()));
Packet = "Od:" + std::to_string(c.GetID()) + "-" + std::to_string(v.ID());
SendToAll(&c, StringToVector(Packet), false, true);
}
Packet = ("L") + c.GetName() + (" left the server!");
SendToAll(&c, StringToVector(Packet), false, true);

View File

@ -137,7 +137,6 @@ void TServer::RemoveClient(const std::weak_ptr<TClient>& WeakClientPtr) {
beammp_assert(LockedClientPtr != nullptr);
TClient& Client = *LockedClientPtr;
beammp_debug("removing client " + Client.GetName() + " (" + std::to_string(ClientCount()) + ")");
// TODO: Send delete packets for all cars
Client.ClearCars();
WriteLock Lock(mClientsMutex);
mClients.erase(WeakClientPtr.lock());