Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if (item->Index == 700)
- {
- int Runes[] = {
- 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117,
- 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125,
- 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133
- };
- int Count = 0;
- for (int i = 0; i < MAX_INVENTORY - 4 && Count != 3; i++)
- {
- int ItemID = mob[client].Mob.Inventory[i].Index;
- if (ItemID <= 0 || ItemID < Runes[0] || ItemID > Runes[23])
- continue;
- for (int y = 0; y < Runes[24]; y++)
- {
- if (ItemID != Runes[y])
- continue;
- if (Count >= 3)
- break;
- Count++;
- }
- }
- if (Count < 3)
- {
- NativeFunctions::sendClientMessage(client, "É necessário ter pelo menos 3 runas no inventário.");
- return true;
- }
- for (int i = 0; i < MAX_INVENTORY - 4 && Count != 0; i++)
- {
- int ItemID = mob[client].Mob.Inventory[i].Index;
- if (ItemID <= 0 || ItemID < Runes[0] || ItemID > Runes[23])
- continue;
- for (int y = 0; y < Runes[24]; y++)
- {
- if (ItemID != Runes[y])
- continue;
- Count--;
- // Fazer aqui a função para apagar o item do inventário do jogador
- memset(&mob->Mob.Inventory[i], 0, sizeof(STRUCT_ITEM));
- // Trava o loop para não apagar mais runas
- if (Count <= 0)
- break;
- }
- }
- static const STRUCT_ITEM premio[] = {
- 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117,
- 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125,
- 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133
- };
- auto slot = Functions::getFirstSlot(client, SlotType::Inventory, 0);
- if (slot == -1)
- {
- NativeFunctions::sendClientMessage(client, "Não possui espaço livre em seu inventário");
- return true;
- }
- else
- {
- NativeFunctions::putItem(client, &premio[rand() % 24]);
- NativeFunctions::sendClientMessage(client, "Barganha realizada com sucesso!");
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement