• 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!

Need Fix Script (NoDmgToParty/Guild)

merfus

Member
Joined
Dec 27, 2011
Messages
214
Reaction score
5
Location
Poland
i searched for script in forum and i got problem, i use tfs 0.3.6pl1 and When i set nodmgtopartymembers true then PvP at server change to Non-Pvp, not only in party, for all players at server pvp is set to non.
Can anyone fix it?

http://otland.net/f82/no-damage-guildmates-no-damage-party-members-139041/


/data/config.lua
Lua:
noDamageToGuildMates = true -- if true then no damage, if false then damage
noDamageToPartyMembers = true -- if true then no damage, if false then damage

/creaturescripts/scripts/partyAndGuildProtection.lua
Lua:
function onCombat(cid, target)
	if(isPlayer(cid) and isPlayer(target)) then
		if(getConfigValue("noDamageToGuildMates")) then
			if(getPlayerGuildId(cid) == getPlayerGuildId(target)) then
				return false
			end
		end
		if(getConfigValue("noDamageToPartyMembers")) then
			if(getPlayerParty(cid) == getPlayerParty(target)) then
				return false
			end
		end
	end
	return true
end

/creaturescripts/creaturescripts.xml
XML:
<event type="combat" name="partyAndGuildProtection" event="script" value="partyAndGuildProtection.lua"/>

/creaturescripts/scripts/login.lua
Lua:
registerCreatureEvent(cid, "partyAndGuildProtection")

Simply, when config values are set to true then players with the same guild or in the same party can't deal damage to eachother.
 
PHP:
function onCombat(cid, target)
        if getWorldType() == WORLD_TYPE_PVP then
	if(isPlayer(cid) and isPlayer(target)) then
		if(getConfigValue("noDamageToGuildMates")) then
			if(getPlayerGuildId(cid) == getPlayerGuildId(target)) then
				return false
			end
		end
		if(getConfigValue("noDamageToPartyMembers")) then
			if(getPlayerParty(cid) == getPlayerParty(target)) then
				return false
			end
		end
	end
end
	return true
end
 
Back
Top