Ejemplo n.º 1
0
 /////////////////////////////////////////
 // CheckPlayerExpireTime(BasePlayer player)
 // One function to take care of the timer, calls himself.
 /////////////////////////////////////////
 void CheckPlayerExpireTime(BasePlayer player)
 {
     if (TimersList[player] != null)
     {
         TimersList[player].Destroy(); TimersList[player] = null;
     }
     if (!player.IsConnected())
     {
         return;
     }
     if (player.IsDead())
     {
         return;
     }
     if (jailinmates[player.userID.ToString()] == null)
     {
         return;
     }
     cachedJail = jailinmates[player.userID.ToString()];
     if (cachedJail.GetExpireTime() < 0)
     {
         return;
     }
     cachedInterval = cachedJail.GetExpireTime() - CurrentTime();
     if (cachedInterval < 1)
     {
         SendPlayerOutOfJail(player);
         RemovePlayerFromJail(player);
     }
     else
     {
         TimersList[player] = timer.Once((float)(cachedInterval + 1), () => CheckPlayerExpireTime(player));
     }
 }
Ejemplo n.º 2
0
 /////////////////////////////////////////
 // CheckPlayerExpireTime(BasePlayer player)
 // One function to take care of the timer, calls himself.
 /////////////////////////////////////////
 void CheckPlayerExpireTime(NetUser player)
 {
     if (TimersList[player] != null)
     {
         TimersList[player].Destroy(); TimersList[player] = null;
     }
     if (player.playerClient == null)
     {
         return;
     }
     if (player.playerClient.controllable == null)
     {
         return;
     }
     if (jailinmates[player.playerClient.userID.ToString()] == null)
     {
         return;
     }
     cachedJail = jailinmates[player.playerClient.userID.ToString()];
     if (cachedJail.GetExpireTime() == -1)
     {
         return;
     }
     cachedInterval = cachedJail.GetExpireTime() - CurrentTime();
     if (cachedInterval < 1)
     {
         SendPlayerOutOfJail(player);
         RemovePlayerFromJail(player);
     }
     else
     {
         TimersList[player] = timer.Once((float)(cachedInterval + 1), () => CheckPlayerExpireTime(player));
     }
 }