Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.98 KB | None | 0 0
  1. else if (item->Index == 700)
  2.             {
  3.                 int Runes[] = {
  4.                     5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117,
  5.                     5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125,
  6.                     5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133
  7.                 };
  8.  
  9.                 int Count = 0;
  10.  
  11.                 for (int i = 0; i < MAX_INVENTORY - 4 && Count != 3; i++)
  12.                 {
  13.                     int ItemID = mob[client].Mob.Inventory[i].Index;
  14.  
  15.                     if (ItemID <= 0 || ItemID < Runes[0] || ItemID > Runes[23])
  16.                         continue;
  17.  
  18.                     for (int y = 0; y < Runes[24]; y++)
  19.                     {
  20.                         if (ItemID != Runes[y])
  21.                             continue;
  22.  
  23.                         if (Count >= 3)
  24.                             break;
  25.  
  26.                         Count++;
  27.                     }
  28.                 }
  29.                 if (Count < 3)
  30.                 {
  31.                     NativeFunctions::sendClientMessage(client, "É necessário ter pelo menos 3 runas no inventário.");
  32.                     return true;
  33.                 }
  34.  
  35.                 for (int i = 0; i < MAX_INVENTORY - 4 && Count != 0; i++)
  36.                 {
  37.                     int ItemID = mob[client].Mob.Inventory[i].Index;
  38.  
  39.                     if (ItemID <= 0 || ItemID < Runes[0] || ItemID > Runes[23])
  40.                         continue;
  41.  
  42.                     for (int y = 0; y < Runes[24]; y++)
  43.                     {
  44.                         if (ItemID != Runes[y])
  45.                             continue;
  46.  
  47.                         Count--;
  48.  
  49.                         // Fazer aqui a função para apagar o item do inventário do jogador
  50.                         memset(&mob->Mob.Inventory[i], 0, sizeof(STRUCT_ITEM));
  51.  
  52.  
  53.                         // Trava o loop para não apagar mais runas
  54.                         if (Count <= 0)
  55.                             break;
  56.                     }
  57.                 }
  58.  
  59.                 static const STRUCT_ITEM premio[] = {
  60.                     5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117,
  61.                     5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125,
  62.                     5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133
  63.                 };
  64.  
  65.                 auto slot = Functions::getFirstSlot(client, SlotType::Inventory, 0);
  66.  
  67.                
  68.  
  69.                 if (slot == -1)
  70.                 {
  71.                     NativeFunctions::sendClientMessage(client, "Não possui espaço livre em seu inventário");
  72.                     return true;
  73.                 }
  74.                 else
  75.                 {
  76.                     NativeFunctions::putItem(client, &premio[rand() % 24]);
  77.                     NativeFunctions::sendClientMessage(client, "Barganha realizada com sucesso!");
  78.                     return true;
  79.                 }
  80.  
  81.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement