Advertisement
julienanid

[Trinity Emudevs] Faction Change token

Sep 16th, 2013
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.90 KB | None | 0 0
  1.         /*
  2.         <--------------------------------------------------------------------------->
  3.          - Developer(s): Ghostcrawler336
  4.          - Edited by: Synth
  5.          - Complete: %100
  6.          - ScriptName: 'Faction Change Token'
  7.          - Comment: Tested.
  8.          - Shared for Emudevs !
  9.         <--------------------------------------------------------------------------->
  10.         */
  11.          
  12.         #include "ScriptMgr.h"
  13.         #include "ScriptedCreature.h"
  14.         #include "Spell.h"
  15.          
  16.         #define item_id 100003
  17.          
  18.         class item_faction : public ItemScript
  19.         {
  20.         public:
  21.             item_faction() : ItemScript("item_faction") { }
  22.          
  23.             bool OnUse(Player* player, Item* item, const SpellCastTargets &)
  24.             {
  25.           if (player->IsInCombat())
  26.          {      
  27.             player->GetSession()->SendNotification("You can't use this item in combat!");
  28.             return true;
  29.          }
  30.         if (player->GetBattleground())
  31.         {
  32.             player->GetSession()->SendNotification("You cannot us this in Battleground!");
  33.             return true;
  34.         }
  35.        
  36.         if (player->IsInFlight())
  37.         {
  38.             player->GetSession()->SendNotification("You cannot use this in Flight!");
  39.             return true;
  40.         }
  41.        
  42.         if(player->InArena())
  43.         {
  44.            player->GetSession()->SendNotification("You cannot use this in an arena match!");
  45.            return true;
  46.         }
  47.                         player->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
  48.                         player->GetSession()->SendNotification("You need to relog,to change your faction !");
  49.                         player->DestroyItemCount(item_id, 1, true, false);
  50.                         return true;
  51.                 }
  52.         };
  53.          
  54.         void AddSC_item_faction()
  55.         {
  56.             new item_faction();
  57.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement