Advertisement
EmuDevs

EmuDevs: TrinityCore - PlayerScript OnPvPKill Reward In Area

Jul 20th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. class on_pvp_kill : public PlayerScript
  2. {
  3. public:
  4.     on_pvp_kill() : PlayerScript("on_pvp_kill") { }
  5.    
  6.     void OnPVPKill(Player* killer, Player* killed)
  7.     {
  8.         if (killer->GetGUID() != killed->GetGUID())
  9.             return;
  10.            
  11.         if (killer->GetAreaId() == 90 && killed->GetAreaId() == 90) // 90 is an example
  12.         {    
  13.             killer->AddItem(30000, 2); // Item 30000 is an example (YOU WERE AWARDED AN ITEM!
  14.             if (killed->HasItemCount(30000, 2)) // Check if the player has the items
  15.                 killed->DestroyItemCount(30000, 2, true); // You were killed, you lose an item
  16.         }
  17.     }
  18. };
  19.  
  20. void AddSC_pvp_kill()
  21. {
  22.     new on_pvp_kill();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement