daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Aug 12th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "StdAfx.h"
  2. #include "Setup.h"
  3.  
  4. #define Dismount_NPC <Hier die ID des NPC eintragen>
  5.  
  6. class DismountAI : public CreatureAIScript
  7. {
  8. public:
  9.     DismountAI(Creature* pCreature) : CreatureAIScript(pCreature) {}
  10.     static CreatureAIScript * Create(Creature * c) { return new DismountAI(c); }
  11.    
  12.     void OnLoad()
  13.     {
  14.        
  15.         _unit->m_invisFlag = 10;
  16.         _unit->m_invisible = true;
  17.         _unit->UpdateVisibility();
  18.         RegisterAIUpdateEvent(250);
  19.     }
  20.  
  21.     void AIUpdate()
  22.     {  
  23.         double Xmin = <Hier die kleinste X-Koordinate eintragen>;
  24.         double Xmax = <Hier die größte X-Koordinate eintragen>;
  25.         double Ymin = <Hier die kleinste Y-Koordinate eintragen>;
  26.         double Ymax = <Hier die größte Y-Koordinate eintragen>;
  27.          
  28.         PlayerStorageMap::iterator itr = _unit->GetMapMgr()->m_PlayerStorage.begin();
  29.         PlayerStorageMap::iterator end = _unit->GetMapMgr()->m_PlayerStorage.end();
  30.         for( ; itr != end; ++itr)
  31.         {
  32.             Player* Plr = itr->second;
  33.             if(Plr->GetPositionX() > Xmin && Plr->GetPositionX() < Xmax && Plr->GetPositionY() > Ymin && Plr->GetPositionY() < Ymax)
  34.             {
  35.                 Plr->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0);
  36.                 if(Plr && Plr->m_MountSpellId)
  37.                     Plr->RemoveAura(Plr->m_MountSpellId);
  38.                 Plr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNTED_TAXI);
  39.             }
  40.         }
  41.     }
  42.  
  43.     void Destroy()
  44.     {
  45.         delete [] this;
  46.     }
  47. };
  48.  
  49. void SetupSMVDismount(ScriptMgr* mgr)
  50. {
  51.     mgr->register_creature_script(Dismount_NPC, &DismountAI::Create);
  52. }
RAW Paste Data
Top