Gelio
Lua PHP C++ programmer
I've made this code for my war. This code make a blocade when you want to attack another player in your party. It run for spells too. Ok, let's go:
In configmanager.cpp:
Under:
Add:
In configmanager.h:
Under:
Add:
In combat.cpp:
Under (around 250 line):
Add:
And thats it. Now compile/rebuild your server and add anywhere in config.lua:
If you set 0 party members will get damage. If you set 1 damage will be ignored and blocked.
Yours,
Gelio
In configmanager.cpp:
Under:
Code:
m_confNumber[MAX_PLAYER_SUMMONS] = getGlobalNumber(L, "maxPlayerSummons", 2);
Code:
m_confNumber[NO_DAMAGE_TO_PARTY_MEMBERS] = getGlobalNumber(L, "noDamageToPartyMembers", 0);
In configmanager.h:
Under:
Code:
MAX_PLAYER_SUMMONS,
Code:
NO_DAMAGE_TO_PARTY_MEMBERS,
In combat.cpp:
Under (around 250 line):
Code:
if((attackerPlayer = attacker->getPlayer()) || (attacker->getMaster()
&& (attackerPlayer = attacker->getMaster()->getPlayer())))
{
Code:
uint32_t party = g_config.getNumber(ConfigManager::NO_DAMAGE_TO_PARTY_MEMBERS);
if(party != 0)
{
Party* attackerPlayerParty = attackerPlayer->getParty();
Party* targetPlayerParty = targetPlayer->getParty();
if(attackerPlayerParty == targetPlayerParty && attackerPlayerParty > 0 && targetPlayerParty > 0)
{
return RET_YOUMAYNOTATTACKTHISPLAYER;
}
}
And thats it. Now compile/rebuild your server and add anywhere in config.lua:
Code:
noDamageToPartyMembers = 1
Yours,
Gelio
Last edited: