fix bug which may cause a server to crash when a car is spawned

thanks @Anonymous275
This commit is contained in:
Lion Kortlepel 2022-10-01 19:10:21 +02:00
parent a1d99c0203
commit 9c6127a105
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -264,7 +264,7 @@ void TServer::ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Networ
int CarID = c.GetOpenCarID();
beammp_debug(c.GetName() + (" created a car with ID ") + std::to_string(CarID));
std::string CarJson = Packet.substr(5);
std::string CarJson = Packet.substr(6);
Packet = "Os:" + c.GetRoles() + ":" + c.GetName() + ":" + std::to_string(c.GetID()) + "-" + std::to_string(CarID) + ":" + CarJson;
auto Futures = LuaAPI::MP::Engine->TriggerEvent("onVehicleSpawn", "", c.GetID(), CarID, Packet.substr(3));
TLuaEngine::WaitForAll(Futures);