Änderung Busfahrer/Pilot Bugs fix siehe Forenbeitrag

This commit is contained in:
Mac_Slash
2020-05-04 03:04:44 +02:00
parent 4dd9afd355
commit 1937846fb2
16 changed files with 498 additions and 262 deletions

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
@@ -49,20 +49,23 @@ namespace ReallifeGamemode.Server.Managers
IQueryable<Door> NearDoors = dbContext.Doors.Where(d => d.Position.DistanceTo(player.Position) <= d.Radius);
foreach (Door d in NearDoors)
{
if (!user.IsAdmin(AdminLevel.ADMIN) && (d.FactionId != user.FactionId || d.FactionId == null))
if (d != null)
{
string lockState = "~r~Du hast kein Recht diese T\u00fcr " + (d.Locked == true ? "auf" : "ab") + "zuschlie\u00dfen!";
player.SendNotification(lockState, true);
continue;
if (!user.IsAdmin(AdminLevel.ADMIN) && (d.FactionId != user.FactionId || d.FactionId == null))
{
string lockState = "~r~Du hast kein Recht diese T\u00fcr " + (d.Locked == true ? "auf" : "ab") + "zuschlie\u00dfen!";
player.SendNotification(lockState, true);
continue;
}
d.Locked = !d.Locked;
string notStr = d.Name + " " + (d.Locked == false ? "~g~auf" : "~r~ab") + "geschlossen";
player.SendNotification(notStr, true);
NAPI.Pools.GetAllPlayers().ForEach(p => p.TriggerEvent("changeDoorState", d.Model, d.X, d.Y, d.Z, (d.Locked ? 1 : 0), 0.0f, 0.0f, 0.0f));
}
d.Locked = !d.Locked;
string notStr = d.Name + " " + (d.Locked == false ? "~g~auf" : "~r~ab") + "geschlossen";
player.SendNotification(notStr, true);
NAPI.Pools.GetAllPlayers().ForEach(p => p.TriggerEvent("changeDoorState", d.Model, d.X, d.Y, d.Z, (d.Locked ? 1 : 0), 0.0f, 0.0f, 0.0f));
}
dbContext.SaveChanges();
}