ar >> dwData >> objid >> nPart;
if( nPart >= MAX_HUMAN_PARTS )
return;. P! I T2 [, @
后面添加
CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
//Crash packet
if ( nPart > 30 || dwData < 0 || nPart < -1) {
Error( "CDPSrvr::OnDoUseItem : Crash Try -> [Player ID: %07d], [Player Name: %s], [Packet used: %d,%d,%d]",
pUser->m_idPlayer, pUser->GetName(), dwData, objid, nPart );
return;
}
然后注释掉下面一行,像这样
//CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
贸易崩溃
找到
ar >> cTab >> nId >> nNum >> dwItemId;
if( cTab >= MAX_VENDOR_INVENTORY_TAB || nNum < 1 )
return;
下面添加
CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
//CRASH
if( cTab < 0 || nId < 0 || nNum > 9999 || dwItemId < 0 ) {
Error( "CDPSrvr::OnBuyItem : Crash Try -> [Player ID: %07d], [Player Name: %s], [Packet used: %d,%d,%d,%d]",
pUser->m_idPlayer, pUser->GetName(), cTab, nId, nNum, dwItemId );
return;
}
然后注释掉下面一行,像这样' a& z1 E3 p8 P7 G
//CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
个人身上物品导致的崩溃
找到
ar >> nPocket1 >> nItem >> nNum >> nPocket2;
if( nPocket1 == nPocket2 )
return;
下面添加
if( nNum <= 0 ) {
Error( "CDPSrvr::OnMoveItemOnPocket : Dupe Try -> [Player ID: %07d], [Player Name: %s], [Packet used: %d,%d,%d,%d]",
pUser->m_idPlayer, pUser->GetName(), nPocket1, nItem, nNum, nPocket2 );
return;
}
& Y& O! y& w+ Z1 T4 ^
//CRASH
if( nItem < 0 || nPocket2 > 2 || nPocket1 < -1 || nPocket1 > 52 ) {
Error( "CDPSrvr::OnMoveItemOnPocket : Crash Try -> [Player ID: %07d], [Player Name: %s], [Packet used: %d,%d,%d,%d]",
pUser->m_idPlayer, pUser->GetName(), nPocket1, nItem, nNum, nPocket2 );
return;
}
然后重新编译源码,并不是所有的崩溃都可以避免,这里只是避免部分错误导致的崩溃。导致服务端的崩溃的可能性很多,还有模型导致的崩溃,还有技能,物品等等,太多了。