OnEntityKill is called when you recall a vehicle.
so if you have "Remove Vehicles On Crash": true, each time you recall the vehicle, you have to rebuy it, as it thinks its crashed.
i made the following changes which seems to fix the issue
so if you have "Remove Vehicles On Crash": true, each time you recall the vehicle, you have to rebuy it, as it thinks its crashed.
i made the following changes which seems to fix the issue
private void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
{
if (entity == null) return;
Vehicle vehicle;
if (!vehiclesCache.TryGetValue(entity, out vehicle)) return;
vehiclesCache.Remove(entity);
if (!configData.settings.notRefundFuelOnCrash)
RefundFuel(entity, vehicle);
if (storedData.playerData.ContainsKey(vehicle.playerID) && storedData.playerData[vehicle.playerID].ContainsKey(vehicle.vehicleType))
{
if (configData.settings.removeVehicleOnCrash)
{
storedData.playerData[vehicle.playerID].Remove(vehicle.vehicleType);
return;
}
storedData.playerData[vehicle.playerID][vehicle.vehicleType].entityID = 0;
storedData.playerData[vehicle.playerID][vehicle.vehicleType].lastDeath = CurrentTime;
}
}
private void OnEntityKill(BaseEntity entity)
{
if (entity == null) return;
Vehicle vehicle;
if (!vehiclesCache.TryGetValue(entity, out vehicle)) return;
vehiclesCache.Remove(entity);
if (!configData.settings.notRefundFuelOnCrash) //on recall also.
RefundFuel(entity, vehicle);
if (storedData.playerData.ContainsKey(vehicle.playerID) && storedData.playerData[vehicle.playerID].ContainsKey(vehicle.vehicleType))
{
storedData.playerData[vehicle.playerID][vehicle.vehicleType].entityID = 0;
storedData.playerData[vehicle.playerID][vehicle.vehicleType].lastDeath = CurrentTime;
}
}