• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Feature [8.31+] Party attack protection

Well first of All Big andHuge thanks to Gelio for this awesome system i have installed it but it gave me an error in configmanager.cpp when i added this code

Code:
m_confNumber[MAX_PLAYER_SUMMONS] = getGlobalNumber(L, "maxPlayerSummons", 2);

at first it pissed me off till iremoved the L,

then the code became

Code:
m_confNumber[MAX_PLAYER_SUMMONS] = getGlobalNumber("maxPlayerSummons", 2);

and it worked perfect in-game

Rep++ added for you :) keep this good work up :thumbup:
 
Lua:
function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(attacker) == false then
		return true
	end

	if isPlayer(cid) == false then
		return true
	end

	if isInParty(cid) == false then
		return true
	end

	if getPlayerParty(cid) == getPlayerParty(attacker) then
		if combat ~= COMBAT_HEALING then
			return false
		end 
	end
	
	return true
end
-.-"
 
@Shawak:
Code:
 function onStatsChange(cid, attacker, type, combat, value)
	if (not isPlayer(attacker) or not isPlayer(cid) or not isInParty(cid) or not isInParty(attacker) or getPlayerParty(cid) ~= getPlayerParty(attacker)) then
		return true
	else
		return false
	end
	return true
end

-.-"
 
Hi!
I think, that this code is very useful, but when I want compile it into my TFS 0.3.6pl1 occured an error. I tried fix it and I did it. :)

configmanager.cpp
Code:
m_conf[B]Bool[/B][NO_DAMAGE_TO_PARTY_MEMBERS] = getGlobal[B]Bool[/B]("noDamageToPartyMembers", [B]true[/B]);

configmanager.h
Code:
NO_DAMAGE_TO_PARTY_MEMBERS,

combat.cpp
Code:
		uint32_t party = g_config.get[B]Bool[/B](ConfigManager::NO_DAMAGE_TO_PARTY_MEMBERS);
		if(party != [B]false[/B])
		{
              Party* attackerPlayerParty = attackerPlayer->getParty();
              Party* targetPlayerParty = targetPlayer->getParty();
              if(attackerPlayerParty == targetPlayerParty && attackerPlayerParty > 0 && targetPlayerParty > 0)
              {
                 return RET_YOUMAYNOTATTACKTHISPLAYER;
              }
        }

config.lua
Code:
noDamageToPartyMembers = [B]true[/B]
 
Last edited:
Hi!
I think, that this code is very useful, but when I want compile it into my TFS 0.3.6pl1 occured an error. I tried fix it and I did it. :)

configmanager.cpp
Code:
m_conf[B]Bool[/B][NO_DAMAGE_TO_PARTY_MEMBERS] = getGlobal[B]Bool[/B]("noDamageToPartyMembers", [B]true[/B]);

configmanager.h
Code:
NO_DAMAGE_TO_PARTY_MEMBERS,

combat.cpp
Code:
		uint32_t party = g_config.get[B]Bool[/B](ConfigManager::NO_DAMAGE_TO_PARTY_MEMBERS);
		if(party != [B]false[/B])
		{
              Party* attackerPlayerParty = attackerPlayer->getParty();
              Party* targetPlayerParty = targetPlayer->getParty();
              if(attackerPlayerParty == targetPlayerParty && attackerPlayerParty > 0 && targetPlayerParty > 0)
              {
                 return RET_YOUMAYNOTATTACKTHISPLAYER;
              }
        }

config.lua
Code:
noDamageToPartyMembers = [B]true[/B]


Thanks alot you are awesome!
:peace:
 
Is it possible to do that it will ONLY work if the PARTY LEADER has turned on EXPERIENCE SHARING? :)
 
Back
Top