Permalink
Browse files

Fixed paused players getting afk kicks.

  • Loading branch information...
1 parent f053fd6 commit 44d34b00339bdfc27dfe499056e9e92f7a7f5c65 @Learath2 Learath2 committed with GreYFoX Apr 6, 2012
Showing with 30 additions and 27 deletions.
  1. +30 −27 src/game/server/player.cpp
View
@@ -396,34 +396,37 @@ bool CPlayer::AfkTimer(int NewTargetX, int NewTargetY)
}
else
{
- // not playing, check how long
- if(m_Sent1stAfkWarning == 0 && m_LastPlaytime < time_get()-time_freq()*(int)(g_Config.m_SvMaxAfkTime*0.5))
- {
- sprintf(
- m_pAfkMsg,
- "You have been afk for %d seconds now. Please note that you get kicked after not playing for %d seconds.",
- (int)(g_Config.m_SvMaxAfkTime*0.5),
- g_Config.m_SvMaxAfkTime
- );
- m_pGameServer->SendChatTarget(m_ClientID, m_pAfkMsg);
- m_Sent1stAfkWarning = 1;
- }
- else if(m_Sent2ndAfkWarning == 0 && m_LastPlaytime < time_get()-time_freq()*(int)(g_Config.m_SvMaxAfkTime*0.9))
- {
- sprintf(
- m_pAfkMsg,
- "You have been afk for %d seconds now. Please note that you get kicked after not playing for %d seconds.",
- (int)(g_Config.m_SvMaxAfkTime*0.9),
- g_Config.m_SvMaxAfkTime
- );
- m_pGameServer->SendChatTarget(m_ClientID, m_pAfkMsg);
- m_Sent2ndAfkWarning = 1;
- }
- else if(m_LastPlaytime < time_get()-time_freq()*g_Config.m_SvMaxAfkTime)
+ if(!m_Paused)
{
- CServer* serv = (CServer*)m_pGameServer->Server();
- serv->Kick(m_ClientID,"Away from keyboard");
- return true;
+ // not playing, check how long
+ if(m_Sent1stAfkWarning == 0 && m_LastPlaytime < time_get()-time_freq()*(int)(g_Config.m_SvMaxAfkTime*0.5))
+ {
+ sprintf(
+ m_pAfkMsg,
+ "You have been afk for %d seconds now. Please note that you get kicked after not playing for %d seconds.",
+ (int)(g_Config.m_SvMaxAfkTime*0.5),
+ g_Config.m_SvMaxAfkTime
+ );
+ m_pGameServer->SendChatTarget(m_ClientID, m_pAfkMsg);
+ m_Sent1stAfkWarning = 1;
+ }
+ else if(m_Sent2ndAfkWarning == 0 && m_LastPlaytime < time_get()-time_freq()*(int)(g_Config.m_SvMaxAfkTime*0.9))
+ {
+ sprintf(
+ m_pAfkMsg,
+ "You have been afk for %d seconds now. Please note that you get kicked after not playing for %d seconds.",
+ (int)(g_Config.m_SvMaxAfkTime*0.9),
+ g_Config.m_SvMaxAfkTime
+ );
+ m_pGameServer->SendChatTarget(m_ClientID, m_pAfkMsg);
+ m_Sent2ndAfkWarning = 1;
+ }
+ else if(m_LastPlaytime < time_get()-time_freq()*g_Config.m_SvMaxAfkTime)
+ {
+ CServer* serv = (CServer*)m_pGameServer->Server();
+ serv->Kick(m_ClientID,"Away from keyboard");
+ return true;
+ }
}
}
return false;

0 comments on commit 44d34b0

Please sign in to comment.