kusanagy

Kick/Mute/Ban Announcer script

Sep 25th, 2017
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.50 KB | None | 0 0
  1. diff -Nuar oregoncore-current/src/game/Level2.cpp oregoncore-pq/src/game/Level2.cpp
  2. --- oregoncore-current/src/game/Level2.cpp  2011-01-01 10:03:08.000000000 -0500
  3. +++ oregoncore-pq/src/game/Level2.cpp   2011-01-01 10:10:04.000000000 -0500
  4. @@ -59,6 +59,10 @@
  5.  //mute player for some times
  6.  bool ChatHandler::HandleMuteCommand(const char* args)
  7.  {
  8. +
  9. +    std::string announce;
  10. +    std::string mutesecname;
  11. +
  12.      if (!*args)
  13.          return false;
  14.  
  15. @@ -75,7 +79,7 @@
  16.      char *mutereason = strtok(NULL, "");
  17.      std::string mutereasonstr;
  18.      if (!mutereason)
  19. -        mutereasonstr = "No reason.";
  20. +        mutereasonstr = "TOS Infraction";
  21.      else
  22.          mutereasonstr = mutereason;
  23.  
  24. @@ -132,6 +136,28 @@
  25.  
  26.      PSendSysMessage(LANG_YOU_DISABLE_CHAT, cname.c_str(), notspeaktime, mutereasonstr.c_str());
  27.  
  28. +    if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
  29. +    {
  30. +        if ( m_session->GetSecurity() == 1 )
  31. +            mutesecname = "GameMaster";
  32. +        if ( m_session->GetSecurity() == 2 )
  33. +            mutesecname = "Moderator";
  34. +        if ( m_session->GetSecurity() == 3 )
  35. +            mutesecname = "Administrator";
  36. +        if ( m_session->GetSecurity() == 4 )
  37. +            mutesecname = "System";
  38. +
  39. +        announce = "The character '";
  40. +        announce += charname;
  41. +        announce += "' was muted for ";
  42. +        announce += timetonotspeak;
  43. +        announce += " minutes by the ";
  44. +        announce += mutesecname;
  45. +        announce += ". The reason is: ";
  46. +        announce += mutereason;
  47. +        HandleAnnounceCommand(announce.c_str());
  48. +    }
  49. +
  50.      return true;
  51.  }
  52.  
  53. @@ -1859,10 +1885,14 @@
  54.  //kick player
  55.  bool ChatHandler::HandleKickPlayerCommand(const char *args)
  56.  {
  57. +
  58. +    std::string announce;
  59. +    std::string kicksecname;
  60. +
  61.      const char* kickName = strtok((char*)args, " ");
  62.      char* kickReason = strtok(NULL, "\n");
  63. -    std::string reason = "No Reason";
  64. -    std::string kicker = "Console";
  65. +    std::string reason = "TOS Infraction";
  66. +    std::string kicker = "System";
  67.      if (kickReason)
  68.          reason = kickReason;
  69.      if (m_session)
  70. @@ -1887,7 +1917,21 @@
  71.  
  72.          if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
  73.          {
  74. -            sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str());
  75. +            if ( m_session->GetSecurity() == 1 )
  76. +                kicksecname = "GameMaster";
  77. +            if ( m_session->GetSecurity() == 2 )
  78. +                kicksecname = "Moderator";
  79. +            if ( m_session->GetSecurity() == 3 )
  80. +                kicksecname = "Administrator";  
  81. +            if ( m_session->GetSecurity() == 4 )
  82. +                kicksecname = "System";
  83. +
  84. +            announce = "The character '";
  85. +            announce += playerName.c_str();
  86. +            announce += " was kicked by the character ";
  87. +            announce += handler->GetSession()->GetPlayerName();
  88. +            announce += ".";
  89. +            sWorld->SendServerMessage(SERVER_MSG_STRING, announce.c_str());
  90.          }
  91.          else
  92.          {
  93. @@ -1932,8 +1976,20 @@
  94.          {
  95.              if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
  96.              {
  97. -
  98. -                sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str());
  99. +                if ( m_session->GetSecurity() == 1 )
  100. +                    kicksecname = "GameMaster";
  101. +                if ( m_session->GetSecurity() == 2 )
  102. +                    kicksecname = "Moderator";
  103. +                if ( m_session->GetSecurity() == 3 )
  104. +                    kicksecname = "Administrator";
  105. +                if ( m_session->GetSecurity() == 4 )
  106. +                    kicksecname = "System";
  107. +                announce = "The character '";
  108. +                announce += player->GetName();
  109. +                announce += "' was kicked by the ";
  110. +                announce += kicksecname;
  111. +                announce += ".";            
  112. +                HandleAnnounceCommand(announce.c_str());
  113.              }
  114.              else
  115.              {
  116. diff -Nuar oregoncore-current/src/game/Level3.cpp oregoncore-pq/src/game/Level3.cpp
  117. --- oregoncore-current/src/game/Level3.cpp  2011-01-01 10:03:08.000000000 -0500
  118. +++ oregoncore-pq/src/game/Level3.cpp   2011-01-01 10:10:04.000000000 -0500
  119. @@ -5562,6 +5562,9 @@
  120.      if (!*args)
  121.          return false;
  122.  
  123. +    std::string announce;
  124. +    std::string bansecname;
  125. +
  126.      char* cnameOrIP = strtok ((char*)args, " ");
  127.      if (!cnameOrIP)
  128.          return false;
  129. @@ -5627,6 +5630,33 @@
  130.              return false;
  131.      }
  132.  
  133. +    if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
  134. +    {
  135. +        if ( m_session->GetSecurity() == 1 )
  136. +            bansecname = "GameMaster";
  137. +        if ( m_session->GetSecurity() == 2 )
  138. +            bansecname = "Moderator";
  139. +        if ( m_session->GetSecurity() == 3 )
  140. +            bansecname = "Administrator";
  141. +        if ( m_session->GetSecurity() == 4 )
  142. +            bansecname = "System";
  143. +
  144. +        if (mode == BAN_CHARACTER)
  145. +            announce = "The character '";
  146. +        else if (mode == BAN_IP)
  147. +            announce = "The IP '";
  148. +        else
  149. +            announce = "Account '";
  150. +        announce += nameOrIP.c_str();
  151. +        announce += "' was banned for ";
  152. +        announce += duration;
  153. +        announce += " by the ";
  154. +        announce += bansecname;
  155. +        announce += ". The reason is: ";
  156. +        announce += reason;
  157. +        HandleAnnounceCommand(announce.c_str());
  158. +    }
  159. +
  160.      return true;
  161.  }
Add Comment
Please, Sign In to add comment