Advertisement
Guest User

QQrofl's/Tommy's Teleport Trigger

a guest
Oct 20th, 2011
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. class Tele_Trigger : public CreatureScript
  2. {
  3.   public:
  4.       Tele_Trigger() : CreatureScript("Tele_Trigger") { }
  5.  
  6.       struct Tele_TriggerAI : public ScriptedAI
  7.       {
  8.           Tele_TriggerAI(Creature * pCreature) : ScriptedAI(pCreature)
  9.           {
  10.              me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  11.              me->SetFloatValue(OBJECT_FIELD_SCALE_X, 0);
  12.              Reset();
  13.           }
  14.  
  15.           uint64 PlayerGUID;
  16.  
  17.           void Reset()
  18.           {
  19.               PlayerGUID = 0;
  20.           }
  21.  
  22.           void MoveInLineOfSight(Unit * who)
  23.           {
  24.               if(!who || (!who->isAlive()) && who->GetTypeId() != TYPEID_PLAYER)
  25.                   return;
  26.  
  27.               if(me->IsWithinDistInMap(who, 9.0f))
  28.               {
  29.                  if(who->GetTypeId() == TYPEID_PLAYER)
  30.                   if(me->GetDistance(who) <= 9.0f)
  31.                   {
  32.                     PlayerGUID = who->GetGUID();
  33.  
  34.                     if(who->ToPlayer()->GetSession()->GetSecurity() == SEC_PLAYER)
  35.                     {
  36.                       me->MonsterSay("You cannot be up here!", LANG_UNIVERSAL, who->GetGUID());      
  37.                       who->ToPlayer()->TeleportTo(0, -13246.55f, 194.03f, 31.00f, 1.09f);
  38.                     }
  39.                     else
  40.                     {
  41.                         // We don't want to kick GameMasters off of there.
  42.                     }
  43.                   }
  44.               }
  45.               PlayerGUID = 0;
  46.           }
  47.       };
  48.  
  49.       CreatureAI * GetAI(Creature * c) const
  50.       {
  51.           return new Tele_TriggerAI(c);
  52.       }
  53. };
  54.  
  55. void AddSC_npc_tele_trigger()
  56. {
  57.    new Tele_Trigger();
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement