Advertisement
EmuDevs

EmuDevs: TrinityCore - Vote Point System Commands

Sep 1st, 2013
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.55 KB | None | 0 0
  1. /*
  2.  *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗
  3.  *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
  4.  *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
  5.  *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
  6.  *            http://emudevs.com
  7. */
  8. #include "VotePoints.h"
  9.  
  10. class cmd_vote_points : public CommandScript
  11. {
  12. public:
  13.     cmd_vote_points() : CommandScript("cmd_vote_points") { }
  14.  
  15.     ChatCommand* GetCommands() const
  16.     {
  17.         static ChatCommand pointCommandTable[] =
  18.         {
  19.             { "getpoints",      SEC_PLAYER,         false, &HandleGetPointsCommand,           "", NULL },
  20.             { NULL,             0,                  false, NULL,                              "", NULL }
  21.         };
  22.  
  23.         static ChatCommand commandTable[]  =
  24.         {
  25.             { "vote",           SEC_PLAYER,         true,  NULL,                              "", pointCommandTable },
  26.             { NULL,             0,                  false, NULL,                              "", NULL }
  27.         };
  28.         return commandTable;
  29.     }
  30.  
  31.     static bool HandleGetPointsCommand(ChatHandler* handler, char const* args)
  32.     {
  33.         Player* player = handler->GetSession()->GetPlayer();
  34.         VotePointSystem* voteSystem = sVoteSystemMgr->GetPointsByAccountId(player->GetSession()->GetAccountId());
  35.         ChatHandler(player->GetSession()).PSendSysMessage("You have %u vote points", voteSystem->Points());
  36.         return true;
  37.     }
  38. };
  39.  
  40. void AddSC_vote_points()
  41. {
  42.     new cmd_vote_points;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement