Skip to content

Commit

Permalink
Update vehicle state after paint packet
Browse files Browse the repository at this point in the history
  • Loading branch information
WiserTixx committed Jan 18, 2025
1 parent 4307faa commit 9d2c3d9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/TServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,17 @@ void TServer::ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Networ
Data = Data.substr(Data.find('['));
LuaAPI::MP::Engine->ReportErrors(LuaAPI::MP::Engine->TriggerEvent("onVehiclePaintChanged", "", c.GetID(), VID, Data));
Network.SendToAll(&c, StringToVector(Packet), false, true);

auto CarData = c.GetCarData(VID);
if (CarData == nlohmann::detail::value_t::null)
return;

if (CarData.contains("vcf") && CarData.at("vcf").is_object())
if (CarData.at("vcf").contains("paints") && CarData.at("vcf").at("paints").is_array()) {
CarData.at("vcf")["paints"] = nlohmann::json::parse(Data);
c.SetCarData(VID, CarData);
}

}
return;
}
Expand Down

0 comments on commit 9d2c3d9

Please sign in to comment.