Ejemplo n.º 1
0
        private void PlayerInit(BasePlayer player)
        {
            if (IsSteamPlayer(player))
            {
                return;
            }

            var IP = ParseIp(player.net.connection.ipaddress);

            if (!_dataAuthorizes.ContainsKey(player.userID))
            {
                var dataAuthorize = new DataAuthorize
                {
                    ListAuthedIps = new List <string>(),
                    LastPosition  = player.transform.position,
                    IsAuthed      = false,
                    Player        = player
                };
                DataAuthorize.AddPlayerToData(player.userID, dataAuthorize);
            }
            else
            {
                var dataAuthorize = _dataAuthorizes[player.userID];
                dataAuthorize.LastPosition = player.transform.position;
                dataAuthorize.IsAuthed     = false;

                if (dataAuthorize.ListAuthedIps.Contains(IP))
                {
                    dataAuthorize.IsAuthed = true;
                    player.ChatMessage(GetMessageLanguage("Authorized.Ip").Replace("{0}", IP));
                    return;
                }
            }

            ForceAuthorization(player);
            DrawInterface(player);
        }
Ejemplo n.º 2
0
 public static void AddPlayerToData(ulong steamid, DataAuthorize dataAuthorize)
 {
     _dataAuthorizes.Add(steamid, dataAuthorize);
 }