PlayerUnknowns

[C++] Disable potion in duel

Oct 10th, 2017
1,316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.17 KB | None | 0 0
  1. //@Source/Game/char_item.cpp
  2. //1.) Add header:
  3.     #include "pvp.h"
  4. //2.) Search:
  5.     case USE_POTION:
  6. //3.) Add after:           
  7.     if (CPVPManager::instance().IsFighting(GetPlayerID()))             
  8.     {
  9.         switch (item->GetVnum())
  10.         {
  11.             case 27001:
  12.             case 27002:
  13.             case 27003:
  14.             case 27004:
  15.             case 27005:
  16.             case 27006:
  17.             ChatPacket(CHAT_TYPE_INFO, "You can not use potions in a duel!");
  18.             return false;
  19.             break;
  20.         }
  21.     }
  22. //@Source/Game/pvp.cpp
  23. //4.) Search:
  24.     void CPVPManager::ConnectEx(LPCHARACTER pkChr, bool bDisconnect)
  25. //5.) Add before:
  26. bool CPVPManager::IsFighting(LPCHARACTER pkChr)
  27. {
  28.     if (!pkChr)
  29.         return false;
  30.  
  31.     return IsFighting(pkChr->GetPlayerID());
  32. }
  33.  
  34. bool CPVPManager::IsFighting(DWORD dwPID)
  35. {
  36.     CPVPSetMap::iterator it = m_map_pkPVPSetByID.find(dwPID);
  37.  
  38.     if (it == m_map_pkPVPSetByID.end())
  39.         return false;
  40.  
  41.     TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin();
  42.  
  43.     while (it2 != it->second.end())
  44.     {
  45.         CPVP * pkPVP = *it2++;
  46.         if (pkPVP->IsFight())
  47.             return true;
  48.     }
  49.  
  50.     return false;
  51. }
  52. //@Source/Game/pvp.h
  53. //4.) Search:
  54.     virtual ~CPVPManager();
  55. //5.) Add after:
  56.     bool            IsFighting(LPCHARACTER pkChr);
  57.     bool            IsFighting(DWORD dwPID);
Advertisement
Add Comment
Please, Sign In to add comment