Advertisement
Easelm

Untitled

May 29th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.51 KB | None | 0 0
  1. IN the header file (.h)
  2.  
  3. bool hasLogged = false;
  4. bool inZone = true;
  5.  
  6. static Position sTeleOut[] =
  7. {
  8.     { -4286.56f, 1330.970f, 161.21f, 0.019994f }
  9. };
  10.  
  11. void DoSendCompleteMessage(string who)
  12. {
  13.     stringstream ss;
  14.     ss << who.c_str()
  15.         << "has completed the Dire Maul Arena Event!"
  16.         << "The event is now opened and ready for another victim!";
  17.     sWorld->SendGlobalText(ss.str().c_str(), NULL);
  18. }
  19.  
  20.  
  21. IN THE .cpp FILE under Arena Commander's ScriptedAI:
  22.  
  23. ADD THIS ABOVE YOUR Reset() function
  24. uint32 checkPlayer;
  25.  
  26. UPDATE YOUR Reset() function and add:
  27.  
  28. checkPlayer = 1000;
  29.  
  30.                if(checkPlayer <= diff)
  31.                {
  32.                    if(m_PlayerGUID == 0)
  33.                        return;
  34.  
  35.                    if(hasLogged || !inZone)
  36.                    {
  37.                         isBattleActive = false;
  38.                         summons.DespawnAll();
  39.                         events.Reset();
  40.                         isWaveBossDead = 0;
  41.                         checkIsDead = true;
  42.                         hasLogged = false;
  43.                         inZone = true;
  44.                         resetOnce = false;
  45.                         player = NULL;
  46.                         m_PlayerGUID = NULL;
  47.                         playerName = "";
  48.                         sWorld->SendGlobalText("A challenger has been scared off and left the Dire Maul Arena Challenge! Who's next?", NULL);
  49.                    }
  50.                     checkPlayer = 1000;
  51.                }
  52.                else
  53.                    checkPlayer -= diff;
  54.  
  55.  
  56.  
  57. THIS IS WHEN THE PLAYER COMPLETES THE EVENT: (Under, EVENT_COMPLETED_WAVES)
  58. DoSendCompleteMessage(player->GetName());
  59.  
  60. IN THE .cpp FILE UNDER THE PlayerScript:
  61. class remove_non_battle_player : public PlayerScript
  62. {
  63.   public:
  64.        remove_non_battle_player() : PlayerScript("remove_non_battle_player") { }
  65.  
  66.        void OnUpdateZone(Player * player, uint32 zone, uint32 area)
  67.        {
  68.            if(m_PlayerGUID == 0)
  69.                return;
  70.  
  71.            if(player->GetZoneId() != DIRE_MAUL_ZONE && player->GetAreaId() != DIRE_MAUL_AREA && player->GetGUID() == m_PlayerGUID)
  72.            {
  73.                inZone = false;
  74.                return;
  75.            }
  76.  
  77.            if(player->GetAreaId() != DIRE_MAUL_AREA || player->GetSession()->GetSecurity() > 1)
  78.                return;
  79.  
  80.            if(isBattleActive && player->GetGUID() != m_PlayerGUID)
  81.            {
  82.                player->TeleportTo(player->GetStartPosition().GetMapId(), player->GetStartPosition().GetPositionX(), player->GetStartPosition().GetPositionY(),
  83.                   player->GetStartPosition().GetPositionZ(), player->GetStartPosition().GetOrientation());
  84.                ChatHandler(player).SendSysMessage("You cannot be in the Dire Maul Arena while the event is going on!");
  85.            }
  86.        }
  87.  
  88.        void OnLogout(Player * player)
  89.        {
  90.            if(m_PlayerGUID == 0)
  91.                return;
  92.  
  93.            if(player->GetGUID() == m_PlayerGUID)
  94.                hasLogged = true;
  95.        }
  96. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement