Ir para conteúdo
Faça parte da equipe! (2024) ×
  • Quem está por aqui   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
  • 0

resolvido COMO ADICIONAR ESTE EVENTO NUMA SORCE


br3n01
 Compartilhar

Pergunta

#include "stdafx.h"

 

bool NpcEvent::NpControl (const int32_t client, MSG_STANDARD* header)

{

p28Bh *packet = (p28Bh*)header;

auto mob = NativeFunctions::getMobFromIndex(header->ClientId);

auto npc = NativeFunctions::getMobFromIndex(packet->npcID);

auto user = Functions::getUserFromIndex(header->ClientId);

auto userData = &Global::userData[header->ClientId];

 

time_t rawnow = time(NULL);

struct tm now;

localtime_s(&now, &rawnow);

 

if (NativeFunctions::getDistance(npc->PosX, npc->PosY, mob->PosX, mob->PosY) > 12)

return false;

 

if (strcmp(npc->Mob.Name, "Guarda_Real_I") == 0)

{

auto luckySlot = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 4900);

if (luckySlot == -1){

NativeFunctions::sendSay(packet->npcID, "Onde esta o Bau I?.");

return true;

}

 

/* auto questItemSlot = Functions::getFirstSlot(client, SlotType::Inventory, 419);

if (questItemSlot == -1) {

NativeFunctions::sendChat(packet->npcID, "Onde esta o Resto de Oriharucon?");

return true;

}*/

 

static const STRUCT_ITEM itemList[] = {

{ 412, 61, 3, 0, 0, 0, 0 },

{ 413, 61, 3, 0, 0, 0, 0 },

{ 4028, 0, 0, 0, 0, 0, 0 },

{ 4026, 0, 0, 0, 0, 0, 0 },

{ 4901, 0, 0, 0, 0, 0, 0 },

};

 

NativeFunctions::sendSay(packet->npcID, "Parabéns.");

 

NativeFunctions::putItem(client, &itemList[rand() % 5]);

short random = Rnd::instance().iRandom(0, 6);

memcpy(&mob->Mob.Inventory[luckySlot], &Global::itemList[random], sizeof(STRUCT_ITEM));

NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, luckySlot, &mob->Mob.Inventory[luckySlot]);

memset(&mob->Mob.Inventory[luckySlot], 0x0, sizeof(STRUCT_ITEM));

// memset(&mob->Mob.Inventory[questItemSlot], 0x0, sizeof(STRUCT_ITEM));

NativeFunctions::sendCarry(client);

return true;

}

 

if (strcmp(npc->Mob.Name, "Guarda_Real_II") == 0)

{

auto luckySlot = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 4901);

if (luckySlot == -1){

NativeFunctions::sendSay(packet->npcID, "Onde esta o Bau II?.");

return true;

}

 

static const STRUCT_ITEM itemList[] = {

{ 3314, 0, 0, 0, 0, 0, 0 },

{ 3312, 0, 0, 0, 0, 0, 0 },

{ 777, 61, 3, 0, 0, 0, 0 },

{ 40, 0, 0, 0, 0, 0, 0 },

{ 4902, 0, 0, 0, 0, 0, 0 },

};

 

NativeFunctions::sendSay(packet->npcID, "Parabéns.");

 

NativeFunctions::putItem(client, &itemList[rand() % 5]);

short random = Rnd::instance().iRandom(0, 6);

memcpy(&mob->Mob.Inventory[luckySlot], &Global::itemList[random], sizeof(STRUCT_ITEM));

NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, luckySlot, &mob->Mob.Inventory[luckySlot]);

memset(&mob->Mob.Inventory[luckySlot], 0x0, sizeof(STRUCT_ITEM));

return true;

}

 

if (strcmp(npc->Mob.Name, "Guarda_Real_III") == 0)

{

auto luckySlot = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 4902);

if (luckySlot == -1){

NativeFunctions::sendSay(packet->npcID, "Onde esta o Bau III?.");

return true;

}

 

static const STRUCT_ITEM itemList[] = {

{ 4140, 0, 0, 0, 0, 0, 0 },

{ 4903, 0, 0, 0, 0, 0, 0 },

{ 2405, 61, 4, 0, 0, 0, 0 },

{ 4020, 61, 3, 0, 0, 0, 0 },

{ 2315, 0, 0, 0, 0, 0, 0 },

};

 

NativeFunctions::sendSay(packet->npcID, "Parabéns.");

 

NativeFunctions::putItem(client, &itemList[rand() % 5]);

short random = Rnd::instance().iRandom(0, 6);

memcpy(&mob->Mob.Inventory[luckySlot], &Global::itemList[random], sizeof(STRUCT_ITEM));

NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, luckySlot, &mob->Mob.Inventory[luckySlot]);

memset(&mob->Mob.Inventory[luckySlot], 0x0, sizeof(STRUCT_ITEM));

return true;

}

 

if (strcmp(npc->Mob.Name, "Guarda_Real_IV") == 0)

{

auto luckySlot = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 4903);

if (luckySlot == -1){

NativeFunctions::sendSay(packet->npcID, "Onde esta o Bau IV?.");

return true;

}

 

static const STRUCT_ITEM itemList[] = {

{ 3363, 10, 10, 0, 0, 0, 0 },

{ 4904, 0, 0, 0, 0, 0, 0 },

{ 3209, 10, 10, 0, 0, 0, 0 },

{ 3208, 10, 10, 0, 0, 0, 0 },

{ 3207, 10, 10, 0, 0, 0, 0 },

{ 3206, 10, 10, 0, 0, 0, 0 },

{ 3205, 10, 10, 0, 0, 0, 0 },

{ 3204, 10, 10, 0, 0, 0, 0 },

{ 3203, 10, 10, 0, 0, 0, 0 },

{ 3202, 10, 10, 0, 0, 0, 0 },

{ 3201, 10, 10, 0, 0, 0, 0 },

{ 3027, 0, 0, 0, 0, 0, 0 },

 

 

 

};

 

NativeFunctions::sendSay(packet->npcID, "Parabéns.");

 

NativeFunctions::putItem(client, &itemList[rand() % 12]);

short random = Rnd::instance().iRandom(0, 13);

memcpy(&mob->Mob.Inventory[luckySlot], &Global::itemList[random], sizeof(STRUCT_ITEM));

NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, luckySlot, &mob->Mob.Inventory[luckySlot]);

memset(&mob->Mob.Inventory[luckySlot], 0x0, sizeof(STRUCT_ITEM));

return true;

}

if (strcmp(npc->Mob.Name, "Guarda_Real_V") == 0)

{

auto luckySlot = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 4904);

if (luckySlot == -1){

NativeFunctions::sendSay(packet->npcID, "Onde esta o Bau V?.");

return true;

}

 

static const STRUCT_ITEM itemList[] = {

{ 3605, 2, 127, 71, 40, 43, 235 },

{ 3628, 2, 127, 71, 60, 43, 235 },

{ 3665, 60, 85, 3, 127, 43, 235 },

{ 3685, 2, 127, 71, 40, 43, 235 },

{ 3705, 2, 127, 71, 40, 43, 235 },

{ 3729, 60, 75, 3, 127, 43, 235 },

{ 3733, 60, 80, 3, 127, 43, 235 },

{ 3765, 2, 127, 71, 80, 43, 235 },

{ 3785, 2, 127, 71, 65, 43, 235 },

{ 3464, 2, 127, 69, 10, 43, 00 },

{ 3464, 2, 127, 70, 10, 43, 00 },

};

 

NativeFunctions::sendSay(packet->npcID, "Parabéns.");

 

NativeFunctions::putItem(client, &itemList[rand() % 11]);

short random = Rnd::instance().iRandom(0, 12);

memcpy(&mob->Mob.Inventory[luckySlot], &Global::itemList[random], sizeof(STRUCT_ITEM));

NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, luckySlot, &mob->Mob.Inventory[luckySlot]);

memset(&mob->Mob.Inventory[luckySlot], 0x0, sizeof(STRUCT_ITEM));

return true;

}

if (strcmp(npc->Mob.Name, "Bau_Missao") == 0)

{

auto luckySlot = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 477);

if (luckySlot == -1){

NativeFunctions::sendSay(packet->npcID, "Onde esta Bau Missao I?.");

return true;

}

 

auto questItemSlot = Functions::getFirstSlot(client, SlotType::Inventory, 478);

if (questItemSlot == -1) {

NativeFunctions::sendChat(packet->npcID, "Onde Esta Bau Missao II?");

return true;

}

auto LuckySlot = Functions::getFirstSlot(client, SlotType::Inventory, 479);

if (LuckySlot == -1) {

NativeFunctions::sendChat(packet->npcID, "Onde Esta Bau Missao III ?");

return true;

}

 

static const STRUCT_ITEM itemList[] = {

{ 1006, 2, 127, 71, 100, 43, 251 },

{ 1007, 2, 127, 71, 100, 43, 251 },

{ 1008, 60, 100, 3, 127, 43, 251 },

{ 1009, 2, 127, 71, 100, 43, 251 },

{ 1010, 2, 127, 71, 100, 43, 251 },

{ 1011, 60, 100, 3, 127, 43, 251 },

{ 1012, 60, 110, 3, 127, 43, 251 },

{ 1013, 2, 127, 71, 120, 43, 251 },

{ 1014, 2, 127, 71, 120, 43, 251 },

{ 1015, 3, 127, 54, 30, 43, 251 },

 

};

 

NativeFunctions::sendSay(packet->npcID, "Parabéns.");

 

NativeFunctions::putItem(client, &itemList[rand() % 10]);

short random = Rnd::instance().iRandom(0, 11);

memcpy(&mob->Mob.Inventory[luckySlot], &Global::itemList[random], sizeof(STRUCT_ITEM));

memcpy(&mob->Mob.Inventory[questItemSlot], &Global::itemList[random], sizeof(STRUCT_ITEM));

memcpy(&mob->Mob.Inventory[luckySlot], &Global::itemList[random], sizeof(STRUCT_ITEM));

NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, luckySlot, &mob->Mob.Inventory[luckySlot]);

NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, questItemSlot, &mob->Mob.Inventory[questItemSlot]);

NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, luckySlot, &mob->Mob.Inventory[luckySlot]);

memset(&mob->Mob.Inventory[luckySlot], 0x0, sizeof(STRUCT_ITEM));

memset(&mob->Mob.Inventory[questItemSlot], 0x0, sizeof(STRUCT_ITEM));

memset(&mob->Mob.Inventory[luckySlot], 0x0, sizeof(STRUCT_ITEM));

return true;

};

 

return true;

}

Link para o comentário
Compartilhar em outros sites

9 respostass a esta questão

Posts Recomendados

  • 0

Olá amigo baixe este programa

É necessário se cadastrar para acessar o conteúdo.

 

E depois adicione o código... Qualquer dúvida não hesite em perguntar!

QUE TIRO FOI ESSE ?

Link para o comentário
Compartilhar em outros sites

  • 0
bs0lut' date=' post: 9620120, member: 4675327"']Olá amigo baixe este programa

É necessário se cadastrar para acessar o conteúdo.

 

E depois adicione o código... Qualquer dúvida não hesite em perguntar!

opa mano agradeço vc tenho visual studio 2013 instalado eu adicionei cod na sorce mais evento naum funciona

Link para o comentário
Compartilhar em outros sites

  • 0

Nao eh apenas colocar e pronto, vc precisa entender a linguagem na qual a source e produzida, para assim saber o local correto de adicao e configuracao desse tipo de codigo!

 

a propria TMSRV tem um sistema de Quests e nele e possivel criar NPCS de Troca, basta estudar!

kraftweerk_body.png

Link para o comentário
Compartilhar em outros sites

Este tópico está impedido de receber novos posts.
 Compartilhar

×
×
  • Criar Novo...

Informação Importante

Nós fazemos uso de cookies no seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies , caso contrário, vamos supor que você está bem para continuar.