add postVehicleEdited

why the fuck is it in past tense
This commit is contained in:
Lion Kortlepel 2024-09-18 16:34:56 +02:00
parent 94768c916d
commit f70514a021
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -354,10 +354,12 @@ void TServer::ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Networ
auto FoundPos = Packet.find('{');
FoundPos = FoundPos == std::string::npos ? 0 : FoundPos; // attempt at sanitizing this
bool Allowed = false;
if ((c.GetUnicycleID() != VID || IsUnicycle(c, Packet.substr(FoundPos)))
&& !ShouldntAllow) {
Network.SendToAll(&c, StringToVector(Packet), false, true);
Apply(c, VID, Packet);
Allowed = true;
} else {
if (c.GetUnicycleID() == VID) {
c.SetUnicycleID(-1);
@ -365,7 +367,12 @@ void TServer::ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Networ
std::string Destroy = "Od:" + std::to_string(c.GetID()) + "-" + std::to_string(VID);
Network.SendToAll(nullptr, StringToVector(Destroy), true, true);
c.DeleteCar(VID);
Allowed = false;
}
auto PostFutures = LuaAPI::MP::Engine->TriggerEvent("postVehicleEdited", "", Allowed, c.GetID(), VID, Packet.substr(3));
// the post event is not cancellable so we dont wait for it
LuaAPI::MP::Engine->ReportErrors(PostFutures);
}
return;
}