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

If AttackerLevel > PlayerLevel/2 then cancelAttack

  • Thread starter Thread starter Rozinx
  • Start date Start date
R

Rozinx

Guest
Is that possible?
Cause I've been having some issues with level 500s killing level 100s
 
onAttack(cid, target)
doesn't have damage amount, sorry

onStatsChange(cid, attacker, type, combat, value)
oh look this one does have it

well onAttack I think does not cover area attacks
this one is abs, theoretically this is what he wants
LUA:
function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(cid) and isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS and getPlayerLevel(attacker) > math.floor(getPlayerLevel(cid)/2) then
		return false
	end
	return true
end
 
Last edited:
onAttack(cid, target)
doesn't have damage amount, sorry

onStatsChange(cid, attacker, type, combat, value)
oh look this one does have it

well onAttack I think does not cover area attacks
this one is abs, theoretically this is what he wants
LUA:
function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(cid) and isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS and getPlayerLevel(attacker) > math.floor(getPlayerLevel(cid)/2) then
		return false
	end
	return true
end
Also if STATSCHANGE_MANALOSS, because of attacked player has mana shield.
 
onAttack(cid, target)
doesn't have damage amount, sorry

onStatsChange(cid, attacker, type, combat, value)
oh look this one does have it

well onAttack I think does not cover area attacks
this one is abs, theoretically this is what he wants
LUA:
function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(cid) and isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS and getPlayerLevel(attacker) > math.floor(getPlayerLevel(cid)/2) then
		return false
	end
	return true
end

Sorry no. You don't need damage anyway...

Use onCombat, it includes area damage and target damage
also throw in a onTarget return false and cancel message. Should do good.
 
Back
Top