public override void OnServerConnect(NetworkConnection conn) { foreach (BanPlayer.Ban ban in BanPlayer.bans) { if (ban.ip == conn.address && BanPlayer.NotExpired(ban.time)) { conn.Disconnect(); } } }
private void FixedUpdate() { if (!this.isDedicated && !this.added && !string.IsNullOrEmpty(base.GetComponent <BanPlayer>().hardwareID)) { this.added = true; try { if (GameObject.Find("Host").GetComponent <NetworkIdentity>().isLocalPlayer) { foreach (BanPlayer.Ban ban in BanPlayer.bans) { if (ban.hardware == base.GetComponent <BanPlayer>().hardwareID&& BanPlayer.NotExpired(ban.time)) { base.GetComponent <NetworkIdentity>().connectionToClient.Disconnect(); this.added = false; return; } } } } catch { } PlayerManager.singleton.AddPlayer(base.gameObject); } base.name = this.label; }