• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Items for killing players

Scooty

Enemia.EU
Joined
Jul 24, 2010
Messages
564
Reaction score
14
Location
Kraków
Hi, i need that script:

when player die him killers get item(ex. scarab coin)

ex.

Boa killed at level 371 by Master Frags, by Hybro, by Graniasty and by Nemezis.

master frags get 1 scarab coin
gybro get 1 scarab coin
graniasty get 1 scarab coin
nemezis get 1 scarab coin


can someone help me, please?

@sorry for my english
 
Last edited:
Should work
LUA:
function onKill(cid, target, lastHit)
if not isPlayer(target) or not isPlayer(cid) then
return true
end
doPlayerAddItem(cid,xxx,1)
return true
end
[Tested on TFS 0.3.6]
 
Last edited:
ok, take reputation.

but i need 2 more functions in this script.

1. something like

if getPlayerLevel(target) >= 100 then player wont get scarab coin

2. and second function(i think harder than first)

player A can take scarab coin from player B only 1 time per 1 hour.
 
Do you mean you can trade a Scarab Coin only once per hour?
As for the getPlayerLevel... you have your code right there, you want it if you kill someone above level 100 you don't get a Scarab Coin, right?
 
I need too second function, player A can get "scarab coin" from player B by killing he, but he will get scarab coin only 1 time per 20 secounds.
 
Last edited:
Aziz:


1. not trade,

function:

when player A kill player B at:

15:40-he will get scarab coin
16:10-he wont get scarab coin
16:40-he will get scarab coin

As for the getPlayerLevel... you have your code right there, you want it if you kill someone above level 100 you don't get a Scarab Coin, right?

not, above level 100, if you kill someone under level 100 you wont get scarab coin
 
LUA:
local item, storage, time = 2159, 5698, 60*60*1000
function onKill(cid, target, lastHit)
	if not isPlayer(target) or not isPlayer(cid) then
		return true
	end
	
	if getPlayerLevel(target) >= 100 then
		if exhaustion.get(cid, storage) < time then
			doPlayerAddItem(cid, item, 1)
			exhaustion.set(cid, storage, time)
		end
	end
	return true
end

Everything you requested is there. They need to be greater than level 100 and they have an hour to wait between scarab coins.
 
LUA:
local item, storage, time = 2159, 5698, 60*60*1000
function onKill(cid, target, lastHit)
	if not isPlayer(target) or not isPlayer(cid) then
		return true
	end
	
	if getPlayerLevel(target) >= 100 then
		if exhaustion.get(cid, storage) < time then
			doPlayerAddItem(cid, item, 1)
			exhaustion.set(cid, storage, time)
		end
	end
	return true
end

Everything you requested is there. They need to be greater than level 100 and they have an hour to wait between scarab coins.

if i kill somebody(i see him body, but not nick)and i have spam with this errors in console:

PHP:
[21:55:02.673] [Error - CreatureScript Interface] 
[21:55:02.673] data/creaturescripts/scripts/abysscoin.lua:onKill
[21:55:02.673] Description: 
[21:55:02.673] data/creaturescripts/scripts/abysscoin.lua:8: attempt to compare boolean with number
[21:55:02.673] stack traceback:
[21:55:02.673]  data/creaturescripts/scripts/abysscoin.lua:8: in function <data/creaturescripts/scripts/abysscoin.lua:2>


and i think your script have exhaustion for all players...you didnt understood me. look:

15:40 - player A kill player B and he got item
16:00 - player A kill player B and he didnt got item
16:00 - player A kill player C and he got item
16:40 - player A kill player B and he got item
 
Last edited:
LUA:
local item = 2159
local time = 60*60*1000
function onKill(cid, target, lastHit)
	if not isPlayer(target) or not isPlayer(cid) then
		return true
	end

	if getPlayerLevel(target) >= 100 then
		if not exhaustion.get(cid, target.uid) or exhaustion.get(cid, target.uid) < time then
			exhaustion.set(cid, target.uid, time)
			doPlayerAddItem(cid, item, 1)
		end
	end
	return true
end

There.
 
Did not see what the others gave you but.

Here.

Code:
function onKill(cid, target, lastHit)
ppos = getPlayerPosition(cid)
if isPlayer(cid) then
   if isPlayer(target) then
      if getPlayerLevel(target) >= (getPlayerLevel(cid) - 5) then
         doPlayerAddItem(cid, 9020, 1)
         doPlayerSendTextMessage(cid, 21, "You killed " .. getCreatureName(target) .. ".") 
      else
          doPlayerSendCancel(cid,"His level is too low in order to get reward")
          doSendMagicEffect(ppos,40)
      end
   end
end 
return TRUE
end
 
LUA:
local item = 2159
local time = 60*60*1000
function onKill(cid, target, lastHit)
	if not isPlayer(target) or not isPlayer(cid) then
		return true
	end

	if getPlayerLevel(target) >= 100 then
		if not exhaustion.get(cid, target.uid) or exhaustion.get(cid, target.uid) < time then
			exhaustion.set(cid, target.uid, time)
			doPlayerAddItem(cid, item, 1)
		end
	end
	return true
end

There.

ehhh ;/ now i have this error in console when im trying to kill somebody:

PHP:
[7:26:50.354] [Error - CreatureScript Interface] 
[7:26:50.354] data/creaturescripts/scripts/abysscoin.lua:onKill
[7:26:50.354] Description: 
[7:26:50.354] data/creaturescripts/scripts/abysscoin.lua:9: attempt to index local 'target' (a number value)
[7:26:50.354] stack traceback:
[7:26:50.354]   data/creaturescripts/scripts/abysscoin.lua:9: in function <data/creaturescripts/scripts/abysscoin.lua:3>
 
LUA:
local item = 2159
local extime = 60*60*1000
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, extime)

function onKill(cid, target, lastHit)
	if not isPlayer(target) or not isPlayer(cid) then
		return true
	end
 
	if getPlayerLevel(target) >= 100 then
		if not hasCondition(cid, CONDITION_EXHAUST) then
			doAddCondition(cid, exhaust)
			doPlayerAddItem(cid, item, 1)
		end
	end
	return true
end
Should work
 
LUA:
local item = 2159 --Default: 2159(Scarab Coin)
local time = 60*60*1000 --Default: 60*60*1000(1 hour)
local storage = 20000 --Default: 20000(Exhaustion Storage)
function onKill(cid, target, lastHit)
	if not isPlayer(target) or not isPlayer(cid) then
		return true
	end
 
	if getPlayerLevel(target) >= 100 then
		if not exhaustion.get(cid, getPlayerGUID(target)+storage) or exhaustion.get(cid, getPlayerGUID(target)+storage) < time then
			exhaustion.set(cid, getPlayerGUID(target)+storage, time)
			doPlayerAddItem(cid, item, 1)
		end
	end
	return true
end

Change the 20000 to anything of your choice, but make sure you don't use the Storage Values 20000 to 25000. That way you don't bug out and you leave room for 5000 characters to be created and still work under that rule.
 
Back
Top