Quote:
Originally Posted by Anothers
Hey first look onMoveRequest in captain herlock source code
This is where move requests come from and the result is determined here.
there if( pClient->IsInBattleArena() ) look this code
You should push back to Move info and send the current coordinates or previus coordinates.
If you send the previous position to the movement information
The character will go to the position you sent.
I learned this while writing code for testing purposes, these are some of the information I know.
Have good day
|
-------------------
tyyyyyyyyyyyyyyyyyyyy its work
-------------------------------
if any one want fix for it this is the full fix()
------------------------------------------------
PHP Code:
void PlayerAreaManager::UpdatePlayerPosition(StructPlayer* player, int x, int y)
{
Position newPlayerPos = { x, y };
// تحقق إذا كان اللاعب داخل المنطقة المحظورة
bool isInCustomArea = IsPointIncludedCCW(customAreaVertices, 4, newPlayerPos);
if (isInCustomArea) {
// إذا كان داخل المنطقة المحظورة، قم بإرجاعه إلى الموقع السابق
Position lastValidPos = { player->GetX(), player->GetY() };
// تأكد من أن اللاعب ليس في نفس المكان الذي كان فيه من قبل
if (lastValidPos.x == x && lastValidPos.y == y) {
// إذا كانت الحركة نفسها، لا تفعل أي شيء
return;
}
player->ChangeLocation(lastValidPos.x, lastValidPos.y);
// إرسال رسالة رفض
SendResult(player, TM_CS_MOVE_REQUEST, RESULT_ACCESS_DENIED);
// استعراض النتيجة في السجل
_cprint("Player position reverted: Access denied to restricted area.");
// هنا يتم منع أي تحرك آخر داخل المنطقة المحظورة
return;
}
// إذا كان خارج المنطقة المحظورة، قم بتحديث الموقع
player->ChangeLocation(x, y);
}
--------------------------------
onmovereq
-------------------------------
PHP Code:
if (PlayerAreaManager::Instance().IsBlocked(playerPos)) {
// إذا كان في منطقة محظورة، قم بإرجاعه إلى الموقع السابق
ArPosition curPos = pClient->GetCurrentPosition(GetArTime());
pClient->ChangeLocation(curPos.x, curPos.y);
// أعد تعبئة معلومات الحركة بالموقع السابق
std::vector<ArPosition> vMoveInfo;
vMoveInfo.push_back(curPos);
// أرسل النتيجة مع الموقع السابق
ArcadiaServer::Instance().SetMultipleMove(pClient, curPos, vMoveInfo, pClient->GetRealMoveSpeed(), true, GetArTime());
SendResult(pClient, pMsg->id, RESULT_ACCESS_DENIED);
_cprint("Movement denied: Player is in restricted area.");
return;
}