Jump to content
Araştır
  • Diğer seçenekler ...
Sonuçları bul ...
Sonuçları bul ...
we1982

Npc id görünmesi

Önerilen Mesajlar

Merhaba npc lere bastığımda id leri örülmekte... aşağıdaki kodda kırmızı ile yazılan yerde görünmemesi için kodu kapatıyorum gameserver patlıyor.. yardımlarınızı rica ederim..


bool CLuaEngine::ExecuteScript(CUser * pUser, CNpc * pNpc, int32 nEventID, int8 bSelectedReward, const char * filename)
{
ScriptBytecodeMap::iterator itr;
bool result = false;

m_lock->AcquireReadLock();
itr = m_scriptMap.find(filename);
if (itr == m_scriptMap.end())
{
// Build full path to script
std::string szPath = LUA_SCRIPT_DIRECTORY;
szPath += filename;

// Release the read lock (we're not reading anymore)
m_lock->ReleaseReadLock();

// Attempt to compile
BytecodeBuffer bytecode;
bytecode.reserve(LUA_SCRIPT_BUFFER_SIZE);
if (!SelectAvailableScript()->CompileScript(szPath.c_str(), bytecode))
{
printf("ERROR: Could not compile Lua script.
");
printf("FILE: %s
", szPath.c_str());
printf("USER: %s
", pUser->GetName().c_str());
printf("ZONE: %d
", pUser->GetZoneID());
printf("NPC ID: %d
", pNpc->m_sSid);
printf("-
");
return false;
}

// Acquire the write lock (we're adding the compiled script)
m_lock->AcquireWriteLock();

// Add the script to our map
m_scriptMap[filename] = bytecode;

// Now that we have the bytecode, we can use it.
result = SelectAvailableScript()->ExecuteScript(pUser, pNpc, nEventID, bSelectedReward,
filename, bytecode);

// Done using the lock.
m_lock->ReleaseWriteLock();
}
else
{
// Already have the bytecode, so now we need to use it.
result = SelectAvailableScript()->ExecuteScript(pUser, pNpc, nEventID, bSelectedReward,
filename, itr->second);

// Done using the lock.
m_lock->ReleaseReadLock();
}

//std::string EventMessage;
//EventMessage = string_format("NpcID = %d - EventID = %d - Lua = %s", pNpc->m_sSid, nEventID, filename);
//Packet EventNotice(WIZ_CHAT, uint8(PUBLIC_CHAT));
//EventNotice GetNation() GetSocketID() //pUser->Send(&EventNotice);


return result;
}

İletiyi paylaş


Link to post
Sitelerde Paylaş

npc nin butun gorev ve yetkilerini kapatmissin galiba ne yapmak istiyorsun npc ile tam anlayamadik sadece isminin gorunmesini istemiyorsan tbl den sil ismini gitsin

duzeltiyorum npc id yazmissin onu kacirmisim gozden pardon :)
-- mesaja ek olarak --
// Npc Events
if (isGM())
{
std::string EventMessage;
EventMessage = string_format("NpcID = %d - EventID = %d - TriggerIndex = %d - DataIndex = %d - CompleteIndex = %d ", pNpc->m_sSid, nEventID, pQuestHelper->nEventTriggerIndex, pQuestHelper->sEventDataIndex , pQuestHelper->nEventCompleteIndex);

Packet EventNotice(WIZ_CHAT, uint8(PUBLIC_CHAT));
EventNotice Send(&EventNotice);
}

bunu dene bi haci

İletiyi paylaş


Link to post
Sitelerde Paylaş
Alıntı

bool CLuaEngine::ExecuteScript(CUser * pUser, CNpc * pNpc, int32 nEventID, int8 bSelectedReward, const char * filename)
{
ScriptBytecodeMap::iterator itr;
bool result = false;

m_lock->AcquireReadLock();
itr = m_scriptMap.find(filename);
if (itr == m_scriptMap.end())
{
// Build full path to script
std::string szPath = LUA_SCRIPT_DIRECTORY;
szPath += filename;

// Release the read lock (we're not reading anymore)
m_lock->ReleaseReadLock();

// Attempt to compile
BytecodeBuffer bytecode;
bytecode.reserve(LUA_SCRIPT_BUFFER_SIZE);
if (!SelectAvailableScript()->CompileScript(szPath.c_str(), bytecode))
{
TRACE("ERROR: Could not compile Lua script.
");
TRACE("FILE: %s
", szPath.c_str());
TRACE("USER: %s
", pUser != nullptr ? pUser->GetName().c_str() : "");
TRACE("ZONE: %d
", pUser != nullptr ? pUser->GetZoneID() : -1);
TRACE("NPC ID: %d
", pNpc != nullptr ? pNpc->GetProtoID() : 0);
TRACE("-
");
return false;
}

std::string sNoticeMessage;
sNoticeMessage = string_format("NpcID : %d - Event ID : %d - Lua : %s", pNpc != nullptr ? pNpc->GetProtoID() : 0,nEventID,szPath.c_str());
Packet sNotice(WIZ_CHAT, uint8(PUBLIC_CHAT));
sNotice GetNation() GetSocketID()
if (!sNoticeMessage.empty())
{
if (pUser->isGM())
pUser->Send(&sNotice);
}

// Acquire the write lock (we're adding the compiled script)
m_lock->AcquireWriteLock();
#if !defined(LUA_SCRIPT_CACHE_DISABLED)
// Add the script to our map
m_scriptMap[filename] = bytecode;
#endif

// Now that we have the bytecode, we can use it.
result = SelectAvailableScript()->ExecuteScript(pUser, pNpc, nEventID, bSelectedReward,
filename, bytecode);

// Done using the lock.
m_lock->ReleaseWriteLock();
}
else
{
// Already have the bytecode, so now we need to use it.
result = SelectAvailableScript()->ExecuteScript(pUser, pNpc, nEventID, bSelectedReward,
filename, itr->second);

// Done using the lock.
m_lock->ReleaseReadLock();
}

return result;
}


"Boş Geliyordur Bole Eklersen Düzelebilir.."

İletiyi paylaş


Link to post
Sitelerde Paylaş

×
×
  • Yeni Oluştur...