Skip to content
18 changes: 15 additions & 3 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,13 @@ bool CStaticFunctionDefinitions::SetElementPosition(CClientEntity& Entity, const
{
RUN_CHILDREN(SetElementPosition(**iter, vecPosition))

if (Entity.GetType() == CCLIENTVEHICLE)
{
CClientPed* driver = static_cast<CClientVehicle&>(Entity).GetOccupant(0);
if (!Entity.IsLocalEntity() && !static_cast<CDeathmatchVehicle&>(Entity).IsSyncing() && (!driver || !driver->IsLocalPlayer()))
return false;
}

if (bWarp)
Entity.Teleport(vecPosition);
else
Expand Down Expand Up @@ -1498,6 +1505,8 @@ bool CStaticFunctionDefinitions::SetElementHealth(CClientEntity& Entity, float f
{
// Grab the model
CClientPed& Ped = static_cast<CClientPed&>(Entity);
if (Ped.IsLocalPlayer())
return false;

// Set the new health
Ped.SetHealth(Clamp(0.0f, fHealth, Ped.GetMaxHealth()));
Expand Down Expand Up @@ -2908,7 +2917,6 @@ bool CStaticFunctionDefinitions::BlowVehicle(CClientEntity& Entity, std::optiona

CClientVehicle& vehicle = static_cast<CClientVehicle&>(Entity);
VehicleBlowFlags blow;

blow.withExplosion = withExplosion.value_or(true);

if (vehicle.IsLocalEntity())
Expand All @@ -2917,11 +2925,15 @@ bool CStaticFunctionDefinitions::BlowVehicle(CClientEntity& Entity, std::optiona
}
else
{
CClientPed* driver = vehicle.GetOccupant(0);
if (!static_cast<CDeathmatchVehicle&>(vehicle).IsSyncing() && (!driver || !driver->IsLocalPlayer()))
return false;

CVector position;
vehicle.GetPosition(position);

const auto type = vehicle.GetType();
const auto state = (blow.withExplosion ? VehicleBlowState::AWAITING_EXPLOSION_SYNC : VehicleBlowState::BLOWN);
const auto type = vehicle.GetType();
const auto state = (blow.withExplosion ? VehicleBlowState::AWAITING_EXPLOSION_SYNC : VehicleBlowState::BLOWN);
eExplosionType explosion;

switch (type)
Expand Down
Loading