Advertisement
jadadev

VIP Commands Script Created by Ghostcrawler

Oct 13th, 2014
876
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.97 KB | None | 0 0
  1. /*
  2. Made by: Ghostcrawler
  3. Updated by : JadaDev
  4. Script Info : VIP Commands Script
  5. Compile : Success.
  6. Note : Contacted Ghostcrawler via skype - ac-web.org about updating his script but there was no answer for 2 - 3 days of waiting so i decided to upload it.
  7. */
  8. #include "ScriptMgr.h"
  9. #include "ObjectMgr.h"
  10. #include "MapManager.h"
  11. #include "Chat.h"
  12. #include "Common.h"
  13. #include "Language.h"
  14.  
  15. class vipcommands : public CommandScript
  16. {
  17. public:
  18.     vipcommands() : CommandScript("vipcommands") { }
  19.  
  20.     ChatCommand* GetCommands() const
  21.     {
  22.         static ChatCommand vipCommandTable[] =
  23.  
  24.         {
  25.             { "mall",       SEC_MODERATOR,     true, &HandleVipMallCommand,         "", NULL },
  26.             { "changerace",    SEC_MODERATOR,  false, &HandleChangeRaceCommand,             "", NULL },
  27.             { "changefaction",  SEC_MODERATOR,  false, &HandleChangeFactionCommand,             "", NULL },
  28.             { "customize",      SEC_MODERATOR,  false, &HandleCustomizeCommand,         "", NULL },
  29.             { "tele",           SEC_MODERATOR,  false, &HandleTeleCommand,              "", NULL },
  30.  
  31.             { NULL,             0,                     false, NULL,                                           "", NULL }
  32.         };
  33.         static ChatCommand commandTable[] =
  34.         {
  35.             { "vip",        SEC_MODERATOR,   true, NULL,      "",  vipCommandTable},
  36.                { NULL,             0,                  false, NULL,                               "", NULL }
  37.         };
  38.         return commandTable;
  39.     }
  40.  
  41.  
  42.  
  43. static bool HandleTeleCommand(ChatHandler* handler, const char* args)
  44.     {
  45.         if (!*args)
  46.             return false;
  47.  
  48.         Player* me = handler->GetSession()->GetPlayer();
  49.  
  50.         // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
  51.         GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
  52.  
  53.         if (!tele)
  54.         {
  55.             handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
  56.             handler->SetSentErrorMessage(true);
  57.             return false;
  58.         }
  59.  
  60.         if (me->IsInCombat())
  61.         {
  62.             handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  63.             handler->SetSentErrorMessage(true);
  64.             return false;
  65.         }
  66.  
  67.         MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
  68.         if (!map || map->IsBattlegroundOrArena())
  69.         {
  70.             handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
  71.             handler->SetSentErrorMessage(true);
  72.             return false;
  73.         }
  74.  
  75.         // stop flight if need
  76.         if (me->IsInFlight())
  77.         {
  78.             me->GetMotionMaster()->MovementExpired();
  79.             me->CleanupAfterTaxiFlight();
  80.         }
  81.         // save only in non-flight case
  82.         else
  83.             me->SaveRecallPosition();
  84.  
  85.         me->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
  86.         return true;
  87.                 }
  88.  
  89. static bool HandlevipCommand(ChatHandler* handler, const char* args)
  90.     {
  91.  
  92.         Player* me = handler->GetSession()->GetPlayer();
  93.  
  94.             me->Say("vip command?", LANG_UNIVERSAL);
  95.             return true;
  96.     }
  97.  
  98. static bool HandleChangeRaceCommand(ChatHandler* handler, const char* args)
  99.     {
  100.  
  101.         Player* me = handler->GetSession()->GetPlayer();
  102.                 me->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
  103.                 handler->PSendSysMessage("Relog to change race of your character.");
  104.         return true;
  105.     }
  106.  
  107. static bool HandleChangeFactionCommand(ChatHandler* handler, const char* args)
  108.     {
  109.  
  110.         Player* me = handler->GetSession()->GetPlayer();
  111.                 me->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
  112.                 handler->PSendSysMessage("Relog to change faction of your character.");
  113.         return true;
  114.     }
  115.  
  116.  
  117. static bool HandleCustomizeCommand(ChatHandler* handler, const char* args)
  118.     {
  119.  
  120.         Player* me = handler->GetSession()->GetPlayer();
  121.                 me->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
  122.                 handler->PSendSysMessage("Relog to customize your character.");
  123.         return true;
  124.     }
  125.  
  126. static bool HandleVipMallCommand(ChatHandler* handler, const char* args)
  127.     {
  128.  
  129.         Player* me = handler->GetSession()->GetPlayer();
  130.  
  131.         if (me->IsInCombat())
  132.         {
  133.             handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  134.             handler->SetSentErrorMessage(true);
  135.             return false;
  136.         }
  137.  
  138.         // stop flight if need
  139.         if (me->IsInFlight())
  140.         {
  141.             me->GetMotionMaster()->MovementExpired();
  142.             me->CleanupAfterTaxiFlight();
  143.         }
  144.         // save only in non-flight case
  145.         else
  146.             me->SaveRecallPosition();
  147.  
  148.                 me->TeleportTo(0,       23.8378f,       -1588.85f,      195.419f,       4.54306f); // MapId, X, Y, Z, O
  149.                 return true;
  150.     }
  151.  
  152.        
  153.        
  154. };
  155.  
  156. void AddSC_vipcommands()
  157. {
  158.     new vipcommands();
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement