public void CheckActivityConnections() { if (NetCull.isServerRunning && Users.NetworkTimeout > 0f && Bootstrap.UpdateTime / 1000u < Users.NetworkTimeout) { uLink.NetworkPlayer[] connections = NetCull.connections; uLink.NetworkPlayer[] array = connections; for (int i = 0; i < array.Length; i++) { uLink.NetworkPlayer networkPlayer = array[i]; NetUser netUser = NetUser.Find(networkPlayer); Character character = null; if (netUser != null && Truth.LastPacketTime.ContainsKey(netUser) && Character.FindByUser(netUser.userID, out character)) { float num = Time.time - Truth.LastPacketTime[netUser]; if (Truth.LastPacketTime[netUser] > 0f && num > Users.NetworkTimeout) { Helper.LogWarning(string.Concat(new object[] { "Kicked by Server [", netUser.displayName, ":", netUser.userID, "]: No receiving packets from client ", num.ToString("F2"), " second(s)." }), true); netUser.Kick(NetError.ConnectionTimeout, true); } } } } }
void OnPlayerVoice(NetUser netuser, List <uLink.NetworkPlayer> players) { int time = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; if (time >= lastTalked[netuser]) { foreach (uLink.NetworkPlayer player in players) { NetUser zaidejas = NetUser.Find(player); if (zaidejas != null) { rust.InventoryNotice(zaidejas, "⤠" + netuser.displayName); } } lastTalked[netuser] = time + 3; } }
public void CheckActivityConnections() { if ((NetCull.isServerRunning && (Users.NetworkTimeout > 0f)) && ((UpdateTime / 0x3e8) < Users.NetworkTimeout)) { foreach (uLink.NetworkPlayer player in NetCull.connections) { NetUser key = NetUser.Find(player); Character character = null; if (((key != null) && Truth.LastPacketTime.ContainsKey(key)) && Character.FindByUser(key.userID, out character)) { float num = Time.time - Truth.LastPacketTime[key]; if ((Truth.LastPacketTime[key] > 0f) && (num > Users.NetworkTimeout)) { Helper.LogWarning(string.Concat(new object[] { "Kicked by Server [", key.displayName, ":", key.userID, "]: No receiving packets from client ", num.ToString("F2"), " second(s)." }), true); key.Kick(NetError.ConnectionTimeout, true); } } } } }
public static NetUser Find(uLink.NetworkPlayer player) { return(NetUser.Find(player)); //return (player.GetLocalData() as NetUser); }