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

CreatureEvent [onKill] if you kill someone more than 3 times..

andypsylon

be be
Joined
Jan 13, 2009
Messages
772
Reaction score
65
Location
de/pl
on request:
http://otland.net/f132/i-found-script-lucaszolson-please-someone-can-you-edit-rep-146067/

Easy to modify
With no storage and no queries to the database!

What it does?
After killing X times the same target(player) from the same ip, killer gets a black skull for X minutes.
Then killer can no longer attack during this time!



in data\creaturescripts\creaturescripts.xml insert:
XML:
	<event type="kill"		name="killFromIp"		event="script" value="kill_fromIp.lua"/>
in data\creaturescripts\scripts\login.lua insert:
Lua:
	registerCreatureEvent(cid, "killFromIp")
create data\creaturescripts\scripts\kill_fromIp.lua and insert:
Lua:
-- ver. 2 2011-12-08
-- author tfs, otland.net/members/andypsylon
--
local c = {
	minutes = 3,
	maxAccKill = 3,
	maxIpKill = 3
}
local blokAcc, blokIP, killweiter = {}, {}, 0

function killFromIp(pid, tid, min)
	local upid, utid, ipid = getPlayerGUID(pid), getPlayerGUID(tid), getPlayerIp(tid)

	if min == 0 then
		blokAcc[upid][utid], blokIP[upid][ipid] = 0, 0
		local skull, skullEnd = getCreatureSkull(pid), getPlayerSkullEnd(pid)
		doCreatureSetSkullType(pid, 0)
		if(skullEnd > 0 and skull > SKULL_BLACK and os.time() > skullEnd) then
			doPlayerSetSkullEnd(pid, 0, skull)
		end
		doCreatureSetSkullType(pid, SKULL_WHITE)
		doPlayerSetSkullEnd(pid, os.time() + c.minutes*60*1000, SKULL_WHITE)
		doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your ".. c.minutes .."min have passed.")
	else
		if not blokAcc[upid] then
			blokAcc[upid], blokIP[upid] = {}, {}
		end
		blokAcc[upid][utid] = (blokAcc[upid][utid] or 0) + 1
		blokIP[upid][ipid] = (blokIP[upid][ipid] or 0) + 1
		if blokAcc[upid][utid] >= c.maxAccKill and blokIP[upid][ipid] >= c.maxIpKill then
			doCreatureSetSkullType(pid, SKULL_BLACK)
			doPlayerSetSkullEnd(pid, os.time() + c.minutes*60*1000, SKULL_BLACK)
			doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed ".. getCreatureName(tid) .." too many times. Black skull for ".. c.minutes .."min.")
		end
		stopEvent(killweiter)
		killweiter = addEvent(killFromIp, min, pid, tid, 0)
	end
end

function onKill(cid, target, lastHit)
	if(not isPlayer(target)) then return true end
	killFromIp(cid, target, c.minutes*60*1000)

	return true
end

is not optimal:)

but it works nicely on tfs 0.4
0.3.6 should also
 
Last edited:
Bro i still gain exp when i kill him over 3 times :(
 
can you add that if you kill a guy 3x you will recive black skull which give you 10% less hp and mana.
 
Error:
[08/12/2011 18:23:38] [Error - CreatureScript Interface]
[08/12/2011 18:23:38] In a timer event called from:
[08/12/2011 18:23:38] data/creaturescripts/scripts/kill_fromIp.lua:eek:nKill
[08/12/2011 18:23:38] Description:
[08/12/2011 18:23:38] (internalGetPlayerInfo) Player not found when requesting player info #18

[08/12/2011 18:23:38] [Error - CreatureScript Interface]
[08/12/2011 18:23:38] In a timer event called from:
[08/12/2011 18:23:38] data/creaturescripts/scripts/kill_fromIp.lua:eek:nKill
[08/12/2011 18:23:38] Description:
[08/12/2011 18:23:38] (internalGetPlayerInfo) Player not found when requesting player info #28
 
I think the function: function killFromIp (pid, tid, min), is not registered in my tfs :S
 
error2.jpg

look new error D:

Code:
-- ver. 1 2011-12-08
-- author tfs, otland.net/members/andypsylon
--
local c = {
	minutes = 10,
	maxAccKill = 3,
	maxIpKill = 3
}
local blokAcc, blokIP, killweiter = {}, {}, 0
 
[COLOR="#FF0000"]function killFromIp(pid, tid, min)
	local upid, utid, ipid = getPlayerGUID(pid), getPlayerGUID(tid), getPlayerIp(tid)
 
	if min == 0 then
		blokAcc[upid][utid], blokIP[upid][ipid] = 0, 0[/COLOR]
		doPlayerSetRate(pid, SKILL__LEVEL, 1)
		if blokAcc[upid][utid] >= c.maxAccKill or blokIP[upid][ipid] >= c.maxIpKill then
			doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your ".. c.minutes .." minutes have passed, now you have normal skills.")
		end
	else
		if not blokAcc[upid] then
			blokAcc[upid], blokIP[upid] = {}, {}
		end
		blokAcc[upid][utid] = (blokAcc[upid][utid] or 0) + 1
		blokIP[upid][ipid] = (blokIP[upid][ipid] or 0) + 1
		if blokAcc[upid][utid] >= c.maxAccKill or blokIP[upid][ipid] >= c.maxIpKill then
			doPlayerSetRate(pid, SKILL__LEVEL, 0)
			doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed ".. getCreatureName(tid) .." too many times. No experence for ".. c.minutes .." min.")
		end
		stopEvent(killweiter)
		killweiter = addEvent(killFromIp, min*60*1000, pid, tid, 0)
	end
end
 
function onKill(cid, target, lastHit)
	if(not isPlayer(target)) then return true end
	killFromIp(cid, target, c.minutes)
 
	return true
end
 
you have old ver. :
-- ver. 1 2011-12-08
replace for the newer version:
-- ver. 2 2011-12-08
 
edit:working good BUT

PHP:
[14/12/2011 19:41:33] [Error - CreatureScript Interface] 
[14/12/2011 19:41:33] In a timer event called from: 
[14/12/2011 19:41:33] data/creaturescripts/scripts/killsameip.lua:onKill
[14/12/2011 19:41:33] Description: 
[14/12/2011 19:41:33] (internalGetPlayerInfo) Player not found when requesting player info #18

[14/12/2011 19:41:33] [Error - CreatureScript Interface] 
[14/12/2011 19:41:33] In a timer event called from: 
[14/12/2011 19:41:33] data/creaturescripts/scripts/killsameip.lua:onKill
[14/12/2011 19:41:33] Description: 
[14/12/2011 19:41:33] (internalGetPlayerInfo) Player not found when requesting player info #28

thats the error after 3 mins when bs off

edit:and after 3 mins when i lost bs i kill again same ip and in 1 kill i get BS
 
Last edited:
Back
Top