事情是staytime
永远不会进入0
但会断开连接。
需要做staytime
吗?
foreach (var playe in w_server.OnlineConnections)
{
if (staytime > 1 * 20000 && play.Value.Map == "Rest")
{
staytime = Server.tickcount.ElapsedMilliseconds;
w_server.Disconnect(play.Value.client.connection);
play.Value.Map = "Village1";
staytime = 0;
}
}
答案 0 :(得分:0)
我认为您需要在playe
中将变量play
更改为foreach
,然后在staytime
之前更改if condition
值。如果您刚刚为0
分配了值,那么如何才能staytime
?
foreach (var play in w_server.OnlineConnections)
{
staytime = Server.tickcount.ElapsedMilliseconds;
if (staytime > 1 * 20000 && play.Value.Map == "Rest")
{
w_server.Disconnect(play.Value.client.connection);
play.Value.Map = "Village1";
staytime = 0;
}
}