Advertisement
Emulation

Untitled

Oct 13th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. #include "ScriptMgr.h"
  2. #include "ObjectMgr.h"
  3. #include "MapManager.h"
  4. #include "Chat.h"
  5. #include "Group.h"
  6.  
  7. class test_commandscript : public CommandScript
  8. {
  9. public:
  10. test_commandscript() : CommandScript("test_commandscript") { }
  11.  
  12. ChatCommand* GetCommands() const
  13. {
  14. static ChatCommand testCommandTable[] =
  15. {
  16. { "command", SEC_PLAYER, false, &HandleTestCommand, "", NULL },
  17. { "gurubashi", SEC_PLAYER, false, &HandleGurubashiCommand, "", NULL },
  18. { NULL, 0, false, NULL, "", NULL }
  19. };
  20. static ChatCommand commandTable[] =
  21. {
  22. { "test", SEC_PLAYER, true, NULL, "", testCommandTable },
  23. { NULL, 0, false, NULL, "", NULL }
  24. };
  25. return commandTable;
  26. }
  27.  
  28. static bool HandleTestCommand(ChatHandler* handler, const char* args)
  29. {
  30.  
  31. Player* me = handler->GetSession()->GetPlayer();
  32.  
  33. me->Say("test command?", LANG_UNIVERSAL);
  34. return true;
  35. }
  36.  
  37. static bool HandleGurubashiCommand(ChatHandler* handler, const char* args)
  38. {
  39.  
  40. Player* me = handler->GetSession()->GetPlayer();
  41.  
  42. if (me->isInCombat())
  43. {
  44. handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  45. handler->SetSentErrorMessage(true);
  46. return false;
  47. }
  48.  
  49. // stop flight if need
  50. if (me->isInFlight())
  51. {
  52. me->GetMotionMaster()->MovementExpired();
  53. me->CleanupAfterTaxiFlight();
  54. }
  55. // save only in non-flight case
  56. else
  57. me->SaveRecallPosition();
  58.  
  59. me->TeleportTo(0, -13181.8f, 339.356f, 42.9805f, 1.18013f); // MapId, X, Y, Z, O
  60. return true;
  61. }
  62. };
  63.  
  64. void AddSC_test_commandscript()
  65. {
  66. new test_commandscript();
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement