tavi 13 Posted September 12, 2016 Share Posted September 12, 2016 Hey I want when a player is polymorphe in a mob, if he try to attack a player, don't let attack.. Please help. Link to comment Share on other sites More sharing options...
Haruka 15 Posted September 12, 2016 Share Posted September 12, 2016 char_battle.cpp Check: Spoiler bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType) Check this now: Spoiler DWORD dwCurrentTime = get_dword_time(); if (IsPC()) { add this: Spoiler if (IsPolymorphed() == true) return false; Looks like it: Spoiler bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType) { if (test_server) sys_log(0, "[TEST_SERVER] Attack : %s type %d, MobBattleType %d", GetName(), bType, !GetMobBattleType() ? 0 : GetMobAttackRange()); //PROF_UNIT puAttack("Attack"); if (!CanMove()) return false; // CASTLE if (IS_CASTLE_MAP(GetMapIndex()) && false == castle_can_attack(this, pkVictim)) return false; // CASTLE DWORD dwCurrentTime = get_dword_time(); if (IsPC()) { if (IsPolymorphed()) return false; if (IS_SPEED_HACK(this, pkVictim, dwCurrentTime)) return false; if (bType == 0 && dwCurrentTime < GetSkipComboAttackByTime()) return false; } else .. // ..etc etc etc Link to comment Share on other sites More sharing options...
VegaS 1087 Posted September 12, 2016 Share Posted September 12, 2016 (edited) [File: src/game/char_battle.cpp -> Function: bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType)] if (!IsGM() && IsPolymorphed() && pkVictim->IsPC()) // If you are GM, you can attack other player when u are polymorphed, but if you not are a GM, cannot make this. { ChatPacket(CHAT_TYPE_INFO, "<<Debug>> Victim %s is a player, you cannot attack him!", pkVictim->GetName()); return false; } Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal 2 Link to comment Share on other sites More sharing options...
tavi 13 Posted September 12, 2016 Author Share Posted September 12, 2016 Thank you. It work very well In that function, i want to add when a player (level 5-15) attack another player (level 15+ , 70,80) the server block the attack... Link to comment Share on other sites More sharing options...
VegaS 1087 Posted September 13, 2016 Share Posted September 13, 2016 int m_nCheckMyLevel = 15, m_nCheckVictimLevel = 15; if (!IsGM() && IsPolymorphed() && pkVictim->IsPC()) /** If you are GM, you can attack other player when u are polymorphed, but if you not are a GM, cannot make this. **/ { if (GetLevel() < m_nCheckMyLevel && pkVictim->GetLevel() >= m_nCheckVictimLevel) /** If you have level the lesser 15 and your victim the level as high as 15, you will not be able to attack him. **/ { ChatPacket(CHAT_TYPE_INFO, "<<Debug>> Informations about victim <Name: %s> <Level: %d>, cannot make that.", pkVictim->GetName(), pkVictim->GetLevel()); return false; } } m_nCheckMyLevel = /** Check if you have the lesser 15 **/ m_nCheckVictimLevel = /** Check if the victim is greater than or equal to 15. **/ Link to comment Share on other sites More sharing options...
tavi 13 Posted September 14, 2016 Author Share Posted September 14, 2016 19 hours ago, VegaS said: int m_nCheckMyLevel = 15, m_nCheckVictimLevel = 15; if (!IsGM() && IsPolymorphed() && pkVictim->IsPC()) /** If you are GM, you can attack other player when u are polymorphed, but if you not are a GM, cannot make this. **/ { if (GetLevel() < m_nCheckMyLevel && pkVictim->GetLevel() >= m_nCheckVictimLevel) /** If you have level the lesser 15 and your victim the level as high as 15, you will not be able to attack him. **/ { ChatPacket(CHAT_TYPE_INFO, "<<Debug>> Informations about victim <Name: %s> <Level: %d>, cannot make that.", pkVictim->GetName(), pkVictim->GetLevel()); return false; } } m_nCheckMyLevel = /** Check if you have the lesser 15 **/ m_nCheckVictimLevel = /** Check if the victim is greater than or equal to 15. **/ I don't want that, I want, when a player level 5-15, in his empire, can't attack anymore another player of another empire. Link to comment Share on other sites More sharing options...
VegaS 1087 Posted September 16, 2016 Share Posted September 16, 2016 if (!IsGM() && IsPolymorphed() && pkVictim->IsPC() && 5 <= GetLevel() && GetLevel() <= 15) { if (GetEmpire() != pkVictim->GetEmpire()){ const char * m_nEmpire[EMPIRE_MAX_NUM] = {"", "Red", "Yellow", "Jinno"}; for (int index = 1; index < 3; index++) { if (pkVictim->GetEmpire() == index) { ChatPacket(CHAT_TYPE_INFO, "<<Debug>> Informations about victim <Name: %s> <Level: %d> <Empire %s> cannot make that!", pkVictim->GetName(), pkVictim->GetLevel(), m_nEmpire[index]); return false; } } } } Link to comment Share on other sites More sharing options...
tavi 13 Posted September 18, 2016 Author Share Posted September 18, 2016 Thanks Vegas. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now