void OnPlayerConnected(Player player) { if (ApiKey == DefaultApiKey || ApiKey == "") { Log("Error! No Steam API key found."); Log("You need to set your API key in the configuration file for this plugin to work!"); Log("To obtain an API key browse to http://steamcommunity.com/dev/apikey"); return; } var playerName = player.DisplayName; var steamId = player.Id.ToString(); if (playerName == "Server" && steamId == "9999999999") return; if (Whitelist != null && Whitelist.Contains(steamId)) { if (LogToConsole) Log($"{playerName} with Steam Id {steamId} is whitelisted, allowing the player to join."); return; } string vacbanurl = $"http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key={ApiKey}&steamids={steamId}"; string familyshareurl = $"http://api.steampowered.com/IPlayerService/IsPlayingSharedGame/v0001/?key={ApiKey}&steamid={steamId}&appid_playing=344760"; string profileurl = $"http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={ApiKey}&steamids={steamId}"; if (VacEnabled) webRequests.EnqueueGet(vacbanurl, (code, response) => IsVacBanned(code, response, player), this); if (ShareEnabled) webRequests.EnqueueGet(familyshareurl, (code, response) => IsFamilySharing(code, response, player), this); if (PrivateEnabled) webRequests.EnqueueGet(profileurl, (code, response) => HasPrivateProfile(code, response, player), this); }
ConnectionError OnUserApprove(ConnectionLoginData data) { if (!blockedPlayersList.ContainsKey(data.PlayerId) || Whitelist.Contains(data.PlayerId.ToString())) return ConnectionError.NoError; if (LogToConsole) Warning(string.Format(blockedPlayersList[data.PlayerId], data.PlayerName + " (" + data.PlayerId + ")")); return ConnectionError.ApprovalDenied; }