Instead reward if you kill someone more than 3 times with the ip: 192.168.222.13 you will not gain any exprience and after 10 min then you can kill him 3 times again. but you can kill other person only that person with that ip you cant get exp after 10min.
Rep for the guy who make it
Rep for the guy who make it
Code:
local block_kills_acc = {}
local block_kills_ip = {}
local max_kills_per_target_account = 3
local max_kills_per_target_ip = 3
function onKill(cid, target, lastHit)
if isPlayer(target) then
local g, a, ip = getPlayerGUID(cid), getPlayerAccountId(target), getPlayerIp(target)
if not block_kills_acc[g] then
block_kills_acc[g] = {}
block_kills_ip[g] = {}
end
block_kills_acc[g][a] = (block_kills_acc[g][a] or 0) + 1
block_kills_ip[g][ip] = (block_kills_ip[g][ip] or 0) + 1
if block_kills_acc[g][a] <= max_kills_per_target_account and block_kills_ip[g][ip] <= max_kills_per_target_ip then
doPlayerAddItem(cid, 2152, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You killed " .. getCreatureName(target) .. " too many times. NO REWARD!")
end
end
return true
end