Advertisement
Rochet2

custom .die

Aug 29th, 2012
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     Player* player = GetSession()->GetPlayer();
  3.     Unit* target = getSelectedUnit();
  4.  
  5.     if (!target || !GetSession()->GetPlayer()->GetSelection())
  6.     {
  7.         SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
  8.         SetSentErrorMessage(true);
  9.         return false;
  10.     }
  11.  
  12.     if (target->GetTypeId() == TYPEID_PLAYER && player->GetSession()->GetSecurity() < 9)
  13.     {
  14.         if (HasLowerSecurity((Player*)target, 0, false))
  15.             return false;
  16.  
  17.         if(!*args)
  18.         {
  19.             PSendSysMessage("You must enter a reason to kill the player.");
  20.             SetSentErrorMessage(true);
  21.             return false;
  22.         }
  23.  
  24.         if (target->GetMap()->IsBattlegroundOrArena())
  25.         {
  26.             SendSysMessage("You can not kill players in a battleground or arena.");
  27.             SetSentErrorMessage(true);
  28.             return false;
  29.         }
  30.  
  31.         std::string diereason = args;
  32.         ChatHandler((Player*)target).PSendSysMessage("GM: |cffFF0000%s|cffFFFF05 has killed you with the kill command. The reason was: |cffFF0000%s|cffFFFF05.|r", player->GetName(), diereason.c_str());
  33.     }
  34.  
  35.     if (target->isAlive())
  36.     {
  37.         if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
  38.             player->Kill(target);
  39.         else
  40.             player->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
  41.     }
  42.  
  43.     return true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement