revert 9c6127a105728afca7b1b7a45d7380fc88d2070d and apply proper fix

This commit is contained in:
Lion Kortlepel 2022-10-03 15:11:26 +02:00
parent 658b37acac
commit 1f14de2e71
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -250,7 +250,7 @@ bool TServer::ShouldSpawn(TClient& c, const std::string& CarJson, int ID) {
}
void TServer::ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Network) {
if (Pckt.length() < 4)
if (Pckt.length() < 6)
return;
std::string Packet = Pckt;
char Code = Packet.at(1);
@ -264,7 +264,7 @@ void TServer::ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Networ
int CarID = c.GetOpenCarID();
beammp_debugf("'{}' created a car with ID {}", c.GetName(), CarID);
std::string CarJson = Packet.substr(6);
std::string CarJson = Packet.substr(5);
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);