Esempio n. 1
0
        /// <summary>
        /// Обработывает успешную авторизацию игрока
        /// </summary>
        private void ProcessLogin(Client player, PlayerInfo playerInfo)
        {
            var appearance = _playersAppearanceProvider.Get(playerInfo.AccountId);

            playerInfo.Skin       = (Skin)appearance.Skin;
            playerInfo.Appearance = appearance;
            API.triggerClientEvent(player, ServerEvent.SHOW_INTERFACE);
            _gtaCharacter.SetAppearance(player, appearance);
            _gtaCharacter.SetClothes(player, playerInfo.Clothes.Where(e => e.OnPlayer).ToList());
            SetPosition(player, playerInfo);
            PlayerManager.SetPlayerName(player, playerInfo);
            player.resetSyncedData(DISABLE_HOTKEYS);
            if (_admins.Contains(player.socialClubName))
            {
                player.setSyncedData("IsAdmin", true);
            }
            if (playerInfo.PhoneNumber != 0)
            {
                player.setSyncedData("HasPhone", true);
            }
            player.freeze(false);
            _playerInfoManager.RefreshUI(player, playerInfo);
            API.sendNativeToPlayer(player, Hash.DISPLAY_RADAR, true);
            API.sendChatMessageToAll($"~g~[Информация]: {playerInfo.Name} зашел на сервер. Онлайн: {ServerState.Players.Count}");
        }
        /// <summary>
        /// Одеть или купить вещь
        /// </summary>
        private void DressOrBuyGood(Client player, object[] args)
        {
            var good       = JsonConvert.DeserializeObject <ClothesModel>(args[0].ToString());
            var playerInfo = _playerInfoManager.GetInfo(player);
            var playerGood = playerInfo.Clothes.FirstOrDefault(e => e.Slot == good.Slot && e.Variation == good.Variation);

            if (playerGood == null)
            {
                if (!BuyGood(player, playerInfo, good))
                {
                    return;
                }
                playerGood = CreateGood(good);
                playerInfo.Clothes.Add(playerGood);
            }
            else if (!playerGood.Textures.Contains(good.Texture))
            {
                if (!BuyGood(player, playerInfo, good))
                {
                    return;
                }
                playerGood.Textures.Add(good.Texture);
            }
            ChangeGood(playerInfo, playerGood, good.Texture);
            _playerInfoManager.RefreshUI(player, playerInfo);
            _gtaCharacter.SetClothes(player, playerGood);
            var district = (int)args[1];

            if (district != Validator.INVALID_ID)
            {
                _clanManager.ReplenishClanBalance(district, good.Price);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Устанавливает данные игрока
        /// </summary>
        private void SetPlayerInfo(Client player, PlayerInfo playerInfo, string playerName, int skin)
        {
            API.setPlayerName(player, playerName);
            playerInfo.Name = playerName;
            playerInfo.Skin = (Skin)skin;
            var clothes = CreateDefaultClothes(playerInfo.Skin);

            playerInfo.Clothes.AddRange(clothes);
            _gtaCharacter.SetClothes(player, clothes);
            _playerInfoManager.RefreshUI(player, playerInfo);
        }
Esempio n. 4
0
 /// <summary>
 /// Устанавливает данные бойца
 /// </summary>
 private void PrepareFighter(Client player, Vector3 position, Vector3 rotation)
 {
     player.setData(PlayerData.FIGHTER, true);
     player.setData(PlayerData.LAST_POSITION, player.position);
     player.setData(PlayerData.LAST_DIMENSION, player.dimension);
     player.freeze(true);
     API.setEntityPosition(player, position);
     API.setEntityRotation(player, rotation);
     API.setPlayerHealth(player, PlayerInfo.MAX_VALUE);
     _gtaCharacter.SetClothes(player, GetFighterClothes(player));
     API.removeAllPlayerWeapons(player);
     API.triggerClientEvent(player, ServerEvent.SET_TIMER, 10, ServerEvent.START_FIGHT);
 }
Esempio n. 5
0
        /// <summary>
        /// Одежда грузчика
        /// </summary>
        private void SetLoaderClothes(Client player, bool isMale)
        {
            var clothes = new List <ClothesModel> {
                new ClothesModel {
                    Slot       = 11, Variation = isMale ? 237 : 74, Torso = isMale ? 126 : 84,
                    Undershirt = isMale ? 59 : 36, Texture = 0, IsClothes = true
                },
                new ClothesModel {
                    Slot = 4, Variation = isMale ? 98 : 101, Texture = 0, IsClothes = true
                },
                new ClothesModel {
                    Slot = 6, Variation = isMale ? 27: 26, Texture = 0, IsClothes = true
                }
            };

            _gtaCharacter.SetClothes(player, clothes);
        }
        /// <summary>
        /// Одеть одежду игрока
        /// </summary>
        public void SetPlayerClothes(Client player, bool withAppearanse = false)
        {
            if (!API.isPlayerConnected(player))
            {
                return;
            }
            if (withAppearanse)
            {
                var playerInfo = GetInfo(player);
                API.setPlayerSkin(player, (PedHash)playerInfo.Skin);
                _gtaCharacter.SetAppearance(player, playerInfo.Appearance);
            }
            var clothes = GetInfo(player).Clothes.Where(e => e.OnPlayer).ToList();

            _gtaCharacter.SetClothes(player, clothes);
        }