0

事情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;
        }
}
4

1 回答 1

0

我认为您需要将变量更改为playeplayforeach,然后staytimeif 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;
    }
}
于 2013-06-13T03:23:30.927 回答