Advertisement
randy336

World Chat System - Updated

Jan 14th, 2013
3,954
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.82 KB | None | 0 0
  1. /*
  2. <--------------------------------------------------------------------------->
  3. - Developer(s): Ghostcrawler336
  4. - Made By??
  5. - Complete: %0
  6. - ScriptName: 'World chat'
  7. - Comment: Untested ingame.
  8. <--------------------------------------------------------------------------->
  9. */
  10.  
  11. #include "ScriptPCH.h"
  12. #include "Chat.h"
  13. #include "Common.h"
  14.  
  15. /* Colors */
  16. #define MSG_COLOR_ORANGE "|cffFFA500"
  17. #define MSG_COLOR_DARKORANGE "|cffFF8C00"
  18. #define MSG_COLOR_RED "|cffFF0000"
  19. #define MSG_COLOR_LIGHTRED "|cffD63931"
  20. #define MSG_COLOR_ROYALBLUE "|cff4169E1"
  21. #define MSG_COLOR_LIGHTBLUE "|cffADD8E6"
  22. #define MSG_COLOR_YELLOW "|cffFFFF00"
  23. #define MSG_COLOR_GREEN "|cff008000"
  24. #define MSG_COLOR_PURPLE "|cffDA70D6"
  25. #define MSG_COLOR_WHITE  "|cffffffff"
  26. #define MSG_COLOR_SUBWHITE  "|cffbbbbbb"
  27.  
  28. /* Ranks */
  29. #define ADMINISTRATOR "Admin"
  30. #define HEADGM "Head GM"
  31. #define GAMEMASTER "GM"
  32. #define DEVELOPER "Developer"
  33. #define OWNER "Owner"
  34. #define VIP "Vip"
  35. #define PLAYER "Player"
  36. #define EVENTM "Event Master"
  37.  
  38.  
  39. class World_Chat : public CommandScript
  40. {
  41.     public:
  42.     World_Chat() : CommandScript("World_Chat") { }
  43.  
  44.     static bool HandleWorldChatCommand(ChatHandler * pChat, const char * msg)
  45.     {
  46.         if(!*msg)
  47.             return false;
  48.  
  49.         Player * player = pChat->GetSession()->GetPlayer();
  50.         char message[1024];
  51.  
  52.         switch(player->GetSession()->GetSecurity())
  53.         {
  54.             case SEC_PLAYER:
  55.                 snprintf(message, 1024, "[World][Player][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_LIGHTBLUE, msg);
  56.                 sWorld->SendGlobalText(message, NULL);
  57.             break;
  58.            
  59.                 case SEC_VIP:
  60.                 snprintf(message, 1024, "[World][Vip][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_PURPLE, msg);
  61.                 sWorld->SendGlobalText(message, NULL);
  62.             break;
  63.            
  64.                 case SEC_GAMEMASTER:
  65.                 snprintf(message, 1024, "[World][GM][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(),  MSG_COLOR_YELLOW, msg);
  66.                 sWorld->SendGlobalText(message, NULL);
  67.             break;
  68.            
  69.                 case SEC_EVENTM:
  70.                 snprintf(message, 1024, "[World][Event Master][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_ORANGE, msg);
  71.                 sWorld->SendGlobalText(message, NULL);
  72.             break;
  73.            
  74.                 case SEC_HEADGM:
  75.                 snprintf(message, 1024, "[World][Head GM][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_GREEN, msg);
  76.                 sWorld->SendGlobalText(message, NULL);
  77.             break;
  78.            
  79.            
  80.                 case SEC_DEVELOPER:
  81.                 snprintf(message, 1024, "[World][Developer][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_ROYALBLUE, msg);
  82.                 sWorld->SendGlobalText(message, NULL);
  83.             break;
  84.            
  85.                 case SEC_ADMINISTRATOR:
  86.                 snprintf(message, 1024, "[World][Admin][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_RED, msg);
  87.                 sWorld->SendGlobalText(message, NULL);
  88.             break;
  89.            
  90.                 case SEC_OWNER:
  91.                 snprintf(message, 1024, "[World][Owner][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_RED, msg);
  92.                 sWorld->SendGlobalText(message, NULL);
  93.             break;
  94.  
  95.             case SEC_CONSOLE:
  96.                 snprintf(message, 1024, "[World][%sAdministrator|r][%s%s|r]: %s%s|r", MSG_COLOR_RED, MSG_COLOR_LIGHTRED, player->GetName().c_str(),
  97.                     MSG_COLOR_LIGHTBLUE, msg);
  98.                 sWorld->SendGlobalText(message, NULL);
  99.             break;
  100.  
  101.            
  102.            
  103.            
  104.         }
  105.         return true;
  106.     }
  107.  
  108.     ChatCommand * GetCommands() const
  109.     {
  110.             static ChatCommand HandleWorldChatCommandTable[] =
  111.             {
  112.                 { "world",  rbac::RBAC_PERM_COMMAND_WORLD_CHAT, true, &HandleWorldChatCommand, "", NULL },
  113.                     { NULL,              0,               false,    NULL,                                  "",  NULL }
  114.             };
  115.             return HandleWorldChatCommandTable;
  116.     }
  117. };
  118.  
  119. void AddSC_World_Chat()
  120. {
  121.         new World_Chat;
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement