Guest User

Untitled

a guest
Jan 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.93 KB | None | 0 0
  1.  //Check inactivity
  2.                     if ((_server._zoneConfig.arena.inactivityTimeout > 0) &&
  3.                         (now - player._lastMovement) > (_server._zoneConfig.arena.inactivityTimeout * 1000) &&
  4.                         player._lastMovement != 0)
  5.                     {
  6.                         player.spec();
  7.                         player.sendMessage(-1, "You have been sent to spectator mode for being inactive");
  8.                     }
  9.                      
  10.                     t = getTerrain(player._state.positionX, player._state.positionY);
  11.  
  12.                     //Check maxTimeAllowed inactivity
  13.                    
  14.                     if (player._arena.getTerrain(player._state.positionX, player._state.positionY).maxTimeAllowed > 0)
  15.                     {
  16.                         int maxTime = (player._arena.getTerrain(player._state.positionX, player._state.positionY).maxTimeAllowed * 1000);
  17.                        
  18.                         //Send message at half of max time
  19.                         if ((now - player._lastMovement) >= (maxTime / 2) && (now - player._lastMovement) <= ((maxTime / 2) + 10) && player._lastMovement != 0)
  20.                         {
  21.                             string format = "WARNING! Staying in this location for another {0} seconds will send you to spectator mode.";
  22.                             player.sendMessage(-1, String.Format(format, ((maxTime / 2) / 1000)));
  23.                         }
  24.                         //Send to spectator due to inactivity
  25.                         //Note: We do the check for over max first
  26.                         if ((now - player._lastMovement) > maxTime && player._lastMovement != 0)
  27.                         {
  28.                             player.spec();                            
  29.                             player.sendMessage(-1, "You have been sent to spectator mode due to inactivity.");
  30.                         }
  31.                        
  32.                     }
Add Comment
Please, Sign In to add comment