From 6032546ee10086f7dff01fe01fe5660530892549 Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 2 Aug 2020 18:25:23 +0200 Subject: [PATCH] auto verkaufen fixen --- ReallifeGamemode.Client/core/rage-mp/events.ts | 6 +++++- ReallifeGamemode.Client/vehiclesync/vehiclesync.ts | 4 ++++ ReallifeGamemode.Server/Managers/InteractionManager.cs | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Client/core/rage-mp/events.ts b/ReallifeGamemode.Client/core/rage-mp/events.ts index 5bc543f8..dbf38b19 100644 --- a/ReallifeGamemode.Client/core/rage-mp/events.ts +++ b/ReallifeGamemode.Client/core/rage-mp/events.ts @@ -1,4 +1,4 @@ -import { IEvents, EventName, Key, IEntity, IVehicle, VehicleSeat } from "../../game"; +import { IEvents, EventName, Key, IEntity, IVehicle, VehicleSeat, EntityType } from "../../game"; import game from "../../index"; import { RageEntity, RageVehicle, RagePlayer } from "./entities"; @@ -65,6 +65,10 @@ export default class RageEvents implements IEvents { onEntityStreamIn(callback: (entity: IEntity) => void): void { mp.events.add("entityStreamIn", (e: EntityMp) => { + if (!e) { + return; + } + var rE: RageEntity; switch (e.type) { case 'vehicle': diff --git a/ReallifeGamemode.Client/vehiclesync/vehiclesync.ts b/ReallifeGamemode.Client/vehiclesync/vehiclesync.ts index 20dc3038..2cd88c2e 100644 --- a/ReallifeGamemode.Client/vehiclesync/vehiclesync.ts +++ b/ReallifeGamemode.Client/vehiclesync/vehiclesync.ts @@ -37,6 +37,10 @@ game.events.onPlayerExitVehicle(() => { }); game.events.onEntityStreamIn((entity: IEntity) => { + if (!entity) { + return; + } + if (entity && entity.type === EntityType.Vehicle) { var data: VehicleData = entity.getSharedData("VehicleData"); diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index 3126135f..ac26a282 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -373,7 +373,7 @@ namespace ReallifeGamemode.Server.Managers dbContext.UserVehicles.Remove(userVehicle); dbContext.SaveChanges(); - veh.Delete(); + veh?.Delete(); } }