Advertisement
Easelm

Reward player Experience and Gold on PvP Kill (In BG)

Apr 21st, 2012
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.39 KB | None | 0 0
  1. /*************************************************************************
  2. *                            [Created By],                               *
  3. *                                 Tommy aka QQrofl                       *
  4. *                                                                        *
  5. *                                                                        *
  6. **************************************************************************/
  7. #include "ScriptPCH.h"
  8. #include "Battleground.h"
  9.  
  10. enum Amounts
  11. {
  12.     MONEY_AMOUNT = 30000,
  13.     EXPERIENCE_AMOUNT = 300
  14. }; 
  15.  
  16. class reward_player_onkill : public PlayerScript
  17. {
  18.    public:
  19.        reward_player_onkill() : PlayerScript("reward_player_onkill") { }
  20.  
  21.        void OnPVPKill(Player * killer, Player * victim)
  22.        {
  23.            if(killer->GetGUID() == victim->GetGUID())
  24.                return;
  25.  
  26.            Battleground * bg = killer->GetBattleground();
  27.  
  28.            if(bg)
  29.            {
  30.                killer->ModifyMoney(killer->GetMoney() + MONEY_AMOUNT);
  31.                killer->GiveXP(EXPERIENCE_AMOUNT, victim);
  32.                killer->MonsterWhisper("|cffffff00Money and experience given!|r", killer->GetGUID());
  33.            }
  34.            else
  35.            {
  36.                // The player doesn't get the reward xp and money
  37.                killer->MonsterWhisper("|cffffff00You must be in a battleground to receive the rewards.|r", killer->GetGUID());
  38.            }
  39.        }
  40. };
  41.  
  42. void AddSC_reward_player_kill()
  43. {
  44.     new reward_player_onkill;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement