Cand cineva da duel poti face sa se intample ceva, daca bagi de exemplu questu care l-am pus si esti in duel o sa iti apara say( test ).
Deschideți pvp.cpp.
Adăugați la sfârșit:
Cod: Selectaţi tot
bool CPVPManager::IsPvP(LPCHARACTER pkChr)
{
CPVPSetMap::iterator it = m_map_pkPVPSetByID.find(pkChr->GetPlayerID());
if (it == m_map_pkPVPSetByID.end())
return false;
TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin();
while (it2 != it->second.end())
{
CPVP * pkPVP = *it2++;
Căutați:
Cod: Selectaţi tot
void Process();Cod: Selectaţi tot
bool IsPvP(LPCHARACTER pkChr);Includeți pvp.h.
Cod: Selectaţi tot
#include "pvp.h"Cod: Selectaţi tot
int is_pvp(lua_State* L)
{
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
if (!npc->IsPC())
{
lua_pushboolean(L, 0);
return 1;
}
CPVP kPVP(ch->GetPlayerID(), npc->GetPlayerID());
CPVP * pkPVP = CPVPManager::instance().Find(kPVP.m_dwCRC);
if (!pkPVP || !pkPVP->IsFight())
{
lua_pushboolean(L, 0);
return 1;
}
lua_pushboolean(L, 1);
return 1;
}Cod: Selectaţi tot
void RegisterPCFunctionTable()Cod: Selectaţi tot
{ "is_pvp", pc_is_pvp },Cod: Selectaţi tot
quest is_pvp begin
state start begin
when login or dead begin
if pc.is_pvp() then
say("test")
return
end
end
end
end

