Advertisement
EG3

C++ World Chat Script by EG3

EG3
Dec 23rd, 2013
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. /* For AC-Web by EG3! */
  2. /* Any problems please report to EG3*/
  3. /*Thanks you DeniDov for fixing it */
  4.  
  5. #include "ScriptPCH.h"
  6. #include "Chat.h"
  7.  
  8. /*RANKS*/ // define ranks like this
  9. #define PLAYER "Player"
  10. #define VOTER "Voter"
  11. #define GAME_MASTER "GM"
  12. #define ADMINISTRATOR"Admin"
  13.  
  14. /*COLORS*/ // define colors like this
  15. #define MSG_COLOR_RED "|cffE61725"
  16. #define MSG_COLOR_BLUE "|cff286BDE"
  17. #define MSG_COLOR_GREEN "|cff28DE3D"
  18. #define MSG_COLOR_WHITE "|cffE6EAF2"
  19.  
  20. class World_Chat : public CommandScript
  21.  
  22. static bool HandleWorldChatCommand(ChatHandler * pChat, const char * msg)
  23. {
  24. if(!*msg)
  25. return false;
  26.  
  27. Player * player = pChat->GetSession()->GetPlayer();
  28. char message[1024];
  29.  
  30. switch(player->GetSession()->GetSecurity())
  31. {
  32. case SEC_PLAYER:
  33. snprintf(message, 1024, "[World][Player][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName(), MSG_COLOR_DARKORANGE, msg);
  34. sWorld->SendGlobalText(message, NULL);
  35. break;
  36.  
  37. case SEC_VOTER:
  38. snprintf(message, 1024, "[World][%sModerator|r][%s%s|r]: %s%s|r", MSG_COLOR_PURPLE, MSG_COLOR_ORANGE, player->GetName(),
  39. MSG_COLOR_GREEN, msg);
  40. sWorld->SendGlobalText(message, NULL);
  41. break;
  42.  
  43. case SEC_GAMEMASTER:
  44. snprintf(message, 1024, "[World][%sGM|r][%s%s|r]: %s%s|r", MSG_COLOR_GREEN, MSG_COLOR_LIGHTBLUE, player->GetName(),
  45. MSG_COLOR_LIGHTBLUE, msg);
  46. sWorld->SendGlobalText(message, NULL);
  47. break;
  48.  
  49. case SEC_ADMINISTRATOR:
  50. snprintf(message, 1024, "[World][%sHead GM|r][%s%s|r]: %s%s|r", MSG_COLOR_LIGHTBLUE, MSG_COLOR_GREEN, player->GetName(),
  51. MSG_COLOR_LIGHTBLUE, msg);
  52. sWorld->SendGlobalText(message, NULL);
  53. break;
  54.  
  55. case SEC_CONSOLE:
  56. snprintf(message, 1024, "[World][%sAdministrator|r][%s%s|r]: %s%s|r", MSG_COLOR_RED, MSG_COLOR_LIGHTRED, player->GetName(),
  57. MSG_COLOR_LIGHTBLUE, msg);
  58. sWorld->SendGlobalText(message, NULL);
  59. break;
  60. }
  61. return true;
  62. }
  63.  
  64. ChatCommand * GetCommands() const
  65. {
  66. static ChatCommand HandleWorldChatCommandTable[] =
  67. {
  68. { "world", SEC_PLAYER, true, &HandleWorldChatCommand, "", NULL },
  69. { NULL, 0, false, NULL, "", NULL }
  70. };
  71. return HandleWorldChatCommandTable;
  72. }
  73. };
  74.  
  75. void AddSC_World_Chat()
  76. {
  77. new World_Chat;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement