View difference between Paste ID: Z1P4tWJA and DbiwJwTJ
SHOW: | | - or go back to the newest paste.
1
--## config ##
2
local maxPlayersByIp = 1
3
4
5
function onStatsChange(cid, attacker, type, combat, value)
6
7
	if type == STATSCHANGE_HEALTHLOSS then -- se for perda de health
8
		if isPlayer(cid) and isPlayer(attacker) then  -- se atacante e atacado forem players
9
			local cidIp = getPlayerIp(cid) -- ip atacado
10
			local arrayPlayersByCidIp = getPlayersByIp(cidIp) -- lista de todos os player para cidIp
11
		
12
			if #arrayPlayersByCidIp > maxPlayersByIp then -- se houver mais de 'maxPlayersByIp' players para esse ip
13-
				doCreatureAddHealth(cid, -value) -- retira de cid(atacado) o mesmo valor que o damage causaria
13+
				doCreatureAddHealth(cid, -math.abs(value)) -- retira de cid(atacado) o mesmo valor que o damage causaria
14
				return false -- retornando false ele não retira a vida por combat, logo não concetriza um kill e obviamente não deixa skull
15
			end
16
		end
17
	end
18
	
19
	return true
20
end