Пример #1
0
        public async Task OnColshape(IColShape colShape, IEntity targetEntity, bool state) => await AltAsync.Do(() =>
        {
            if (!state)
            {
                return;
            }
            if (colShape == null || !colShape.Exists)
            {
                return;
            }
            if (targetEntity.Type != BaseObjectType.Player)
            {
                return;
            }

            Alt.Log("Busy");

            BusEntity busEntity = colShape.GetBusEntity();

            if (busEntity == null || busEntity.ColShape != colShape)
            {
                return;
            }

            IPlayer player = targetEntity as IPlayer;

            if (player.IsInVehicle)
            {
                return;
            }

            new Interaction(player, "bus:openWindow", "aby otworzyć ~g~rozkład jazdy");
            player.SetData("current:bus", busEntity);
        });
Пример #2
0
        public async Task CreateBusStationCMD(IPlayer sender, string name, int busStopId, int cost, float time) => await AltAsync.Do(async() =>
        {
            if (!sender.GetAccountEntity().HasRank((int)EAdmin.Supporter))
            {
                return;
            }

            if (!sender.GetAccountEntity().OnAdminDuty)
            {
                sender.SendErrorNotify("Wystąpił bląd!", "Aby użyć tej komendy musisz wejść na służbę administratora");
                return;
            }

            BusStopStation busStopStation = new BusStopStation()
            {
                BusStopId = busStopId,
                Name      = name,
                PosX      = sender.Position.X,
                PosY      = sender.Position.Y,
                PosZ      = sender.Position.Z,
                CreatorId = sender.GetAccountEntity().DbModel.Id,
                Cost      = cost,
                Time      = time
            };

            BusEntity bus = EntityHelper.GetById(busStopId);
            if (bus == null)
            {
                return;
            }

            await bus.CreateStation(busStopStation);
        });
Пример #3
0
 public static async Task LoadBusAsync(UnitOfWork unit)
 {
     foreach (BusStop busStop in await unit.BusRepository.GetAll())
     {
         Alt.Log($"[BUS-ENTITY: LOAD]: bus o ID: {busStop.Id} został wczytany poprawnie!");
         BusEntity busEntity = new BusEntity(busStop);
         await busEntity.Spawn();
     }
 }
Пример #4
0
        public async Task CreateBusStopCMD(IPlayer sender) => await AltAsync.Do(async() =>
        {
            if (!sender.GetAccountEntity().HasRank((int)EAdmin.Supporter))
            {
                return;
            }

            if (!sender.GetAccountEntity().OnAdminDuty)
            {
                sender.SendErrorNotify("Wystąpił bląd!", "Aby użyć tej komendy musisz wejść na służbę administratora");
                return;
            }

            BusStop busStop = new BusStop()
            {
                PosX      = sender.Position.X,
                PosY      = sender.Position.Y,
                PosZ      = sender.Position.Z,
                CreatorId = sender.GetAccountEntity().DbModel.Id
            };

            BusEntity busEntity = new BusEntity(busStop);
            await busEntity.Spawn(true);
        });