Advertisement
Rochet2

Rochet2's version of QQrofl's/Tommy's Teleport Trigger

Nov 5th, 2011
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Tele_Trigger : public CreatureScript
  2. {
  3.     public:
  4.     Tele_Trigger() : CreatureScript("Tele_Trigger") { }
  5.     struct Tele_TriggerAI : public ScriptedAI
  6.     {
  7.         Tele_TriggerAI(Creature * pCreature) : ScriptedAI(pCreature)
  8.         {
  9.             me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  10.             me->SetFloatValue(OBJECT_FIELD_SCALE_X, 0);
  11.         }
  12.        
  13.         void MoveInLineOfSight(Unit * who)
  14.         {
  15.             if(!who || (!who->isAlive()) && who->GetTypeId() != TYPEID_PLAYER)
  16.                 return;
  17.  
  18.             if(me->IsWithinDistInMap(who, 9.0f) && who->GetTypeId() == TYPEID_PLAYER && me->GetDistance(who) <= 9.0f && who->ToPlayer()->GetSession()->GetSecurity() == SEC_PLAYER)
  19.             {
  20.                 me->MonsterSay("You cannot be up here!", LANG_UNIVERSAL, who->GetGUID());      
  21.                 who->ToPlayer()->TeleportTo(0, -13246.55f, 194.03f, 31.00f, 1.09f);
  22.             }
  23.         }
  24.     }
  25.    
  26.     CreatureAI * GetAI(Creature * c) const
  27.     {
  28.         return new Tele_TriggerAI(c);
  29.     }
  30. }
  31.  
  32. void AddSC_npc_tele_trigger()
  33. {
  34.    new Tele_Trigger();
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement