Esempio n. 1
0
        /// <summary>
        /// Создать продавца
        /// </summary>
        private void CreateSeller(VehicleShowroomModel showroom)
        {
            var name   = showroom.Type == ShowroomType.Cheap ? "Саймон" : "Консультант";
            var seller = _pointCreator.CreatePed(
                showroom.Seller, name, showroom.SellerPosition, showroom.SellerRotation,
                showroom.SellerMarkerPosition, Colors.VividCyan
                );

            seller.ColShape.onEntityEnterColShape += (shape, entity) => PlayerComeToSeller(entity, showroom);
            seller.ColShape.onEntityExitColShape  += PlayerAwayFromSeller;
        }
Esempio n. 2
0
        /// <summary>
        /// Обработчик двери салона
        /// </summary>
        private void TriggerShowroomEnter(NetHandle entity, VehicleShowroomModel showroom, bool enter)
        {
            var player = API.getPlayerFromHandle(entity);

            if (!PlayerHelper.PlayerCorrect(player))
            {
                return;
            }
            API.sendNativeToPlayer(player, Hash.DISPLAY_RADAR, !enter);
            API.setEntityPosition(player, enter ? showroom.PositionAfterEnter : showroom.PositionAfterExit);
        }
Esempio n. 3
0
        /// <summary>
        /// Игрок подошел к консультанту
        /// </summary>
        private async void PlayerComeToSeller(NetHandle entity, VehicleShowroomModel showroom)
        {
            var player = API.getPlayerFromHandle(entity);

            if (!PlayerHelper.PlayerCorrect(player))
            {
                return;
            }
            var vehicles = await SerializeVehicles(player, showroom.Type);

            API.triggerClientEvent(player,
                                   ServerEvent.SHOW_SHOWROOM_MENU, vehicles.Item1, vehicles.Item2,
                                   JsonConvert.SerializeObject(showroom.ShowroomPositions), (int)showroom.Type, showroom.District
                                   );
        }