julienanid

[Trinity] Reward Money Commands

Sep 29th, 2013
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.66 KB | None | 0 0
  1. /*
  2. <--------------------------------------------------------------------------->
  3.  - Developer(s): Ghostcrawler336
  4.  - Complete: 100%
  5.  - ScriptName: 'Reward Command'
  6.  - Comment: Untested
  7.  - Shared for: Emudevs
  8. <--------------------------------------------------------------------------->
  9. */
  10.  
  11. #include "ScriptMgr.h"
  12. #include "Chat.h"
  13. #include "Common.h"
  14. #include "Language.h"
  15.  
  16. enum
  17. {
  18.     Money_1 = 100000,   // Define the amount of money you want here (100 gold)
  19.     Money_2 = 750000,   // Define the amount of money you want here (75 gold)
  20.     Money_3 = 500000  // Define the amount of money you want here (50 gold)
  21. };
  22.  
  23. class reward_command : public CommandScript
  24. {
  25. public:
  26.     reward_command() : CommandScript("reward_command") { }
  27.  
  28.     ChatCommand* GetCommands() const
  29.     {
  30.         static ChatCommand rewardCommandTable[] =
  31.  
  32.         {
  33.         { "first",    2,  false, &HandleReward,         "", NULL },
  34.         { "second",   2,  false, &HandleReward1,         "", NULL },
  35.         { "third",    2,  false, &HandleReward2,         "", NULL },
  36.         { NULL,             0,                     false, NULL,          "", NULL }
  37.         };
  38.         static ChatCommand commandTable[] =
  39.         {
  40.             { "reward",     2,   true, NULL,      "",  rewardCommandTable},
  41.            { NULL,             0,                  false, NULL,                               "", NULL }
  42.         };
  43.         return commandTable;
  44.     }
  45. static bool HandleReward(ChatHandler* handler, const char* args) // Give player 100 gold
  46.     {  
  47.                Player* pPlayer = handler->GetSession()->GetPlayer();
  48.                Player* plTarget = pPlayer->GetSelectedPlayer();
  49.                plTarget->ModifyMoney(Money_1);
  50.                handler->PSendSysMessage("|cffB400B4Congratulations you have won yourself 100 gold!");
  51.                return true;
  52.     }
  53. static bool HandleReward1(ChatHandler * handler, const char * args) // Give player 75 gold
  54.     {          Player* pPlayer = handler->GetSession()->GetPlayer();
  55.                Player* plTarget = pPlayer->GetSelectedPlayer();
  56.                plTarget->ModifyMoney(Money_2);
  57.               handler->PSendSysMessage("|cffB400B4Congratulations you have won yourself 75 gold!");
  58.               return true;      
  59.     }
  60. static bool HandleReward2(ChatHandler* handler, const char* args) // Give player 50 gold
  61.     {
  62.                Player* pPlayer = handler->GetSession()->GetPlayer();
  63.                Player* plTarget = pPlayer->GetSelectedPlayer();
  64.                plTarget->ModifyMoney(Money_3);
  65.                handler->PSendSysMessage("|cffB400B4Congratulations you have won yourself 50 gold!");
  66.                return true;
  67.     }
  68. };
  69. void AddSC_reward_command()
  70. {
  71.     new reward_command();
  72. }
Add Comment
Please, Sign In to add comment