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

CreatureEvent Frag Reward: Trophy? Heart? Both? You Choose!

The item should be added to your backpack not lootable. Thats what i think ;)
 
The item should be added to your backpack not lootable. Thats what i think ;)

This can be changed. I find that a heart belongs in a body. However, the trophy could be added to a bag.

Maybe I'll make an update (putTrophyInBag = true/false).

J.Dre
 
Yeah, no errors in console but it doesn't do anything when you kill a player.
 
This was made for newer versions of TFS. The ones you use are becoming quite ancient.
 
Edit: works on rev 3884, just didn't work for me because I was mcing characters. When I tested it on another player it worked 100%

+rep
 
Last edited:
Newer revisions which are like 9.X.
 
Im having a problem with this script, when 3 people kill the same person. There is 3 sets of the heart and trophy, yet in only one name. Is there a way to set it so the maximum amount of trophys dropped is 1, and it only goes to who did the most damage. IF you cant, just make it so it says the names of the other people attacking for example adding the names to the one trophy instead of making seperate ones.

Ex: You see a frag trophy. It was achieved when Name, Name, and Name killed Name.

thankss, not a major problem, but could cause bugs in wars of 10 people atking one person.
 
it doesn't work for me :( no errors just nothing happens :S
 
I'm not sure, but I think this works, test:
Code:
local config = {
	useTrophy = "yes", -- "yes" or "no"
	useHeart = "yes", -- "yes" or "no"
	killers = 1 -- only the actual killer gets rewarded.
}
 
local BRONZE, SILVER, GOLD = 10129, 10128, 10127
 
function onDeath(cid, corpse, deathList)
	local reward = 0
 
	if(config.useTrophy) then
		config.useTrophy = getBooleanFromString(config.useTrophy)
	end
	if(config.useHeart) then
		config.useHeart = getBooleanFromString(config.useHeart)
	end
 
	local worldType = getConfigValue("worldType")
	if(worldType == "open") then
		for i = 1, config.killers do
item = doAddContainerItem(corpse.uid, 5943, 1)
			if(isPlayer(cid) and isPlayer(deathList[i])) then
				if(getPlayerIp(cid) ~= getPlayerIp(deathList[i])) then
 
					local var = {
						KILLER_NAME = getCreatureName(deathList[i]),
						TARGET_NAME = getCreatureName(cid),
						KILLER_LEVEL = getPlayerLevel(deathList[i]),
						TARGET_LEVEL = getPlayerLevel(cid)
					}
 
					if(var.TARGET_LEVEL > 8 and var.TARGET_LEVEL < 100) then 
						reward = BRONZE
					elseif(var.TARGET_LEVEL > 99 and var.TARGET_LEVEL < 200) then
						reward = SILVER
					elseif(var.TARGET_LEVEL > 199) then
						reward = GOLD
					end
 
					local trophy, heart = 0, 0
					if(config.useHeart) then
						heart = doAddContainerItem(corpse.uid, 5943, 1)
					end
 
					if(config.useTrophy) then
						trophy = doPlayerAddItem(deathList[i], reward, 1)
					end
 
					local killers = ""
					for i = 1, math.min(getConfigInfo('deathAssistCount') + 1, #deathList) do
						killers = killers .. (i == 1 and "" or ", ") .. (isMonster(deathList[i]) and "a " or "") .. getCreatureName(deathList[i])
					end
 
					if(config.useHeart) then
						doItemSetAttribute(heart, "name", "Heart of " .. var.TARGET_NAME)
						doItemSetAttribute(heart, "description", "It was taken from " .. var.TARGET_NAME .. "'s body. " .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. var.TARGET_LEVEL .. " by " .. var.KILLER_NAME .. ". " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "(Unjustified)" or "(Justified)"))
					end
 
					if(config.useTrophy) then
						doItemSetAttribute(trophy, "description", "It was awarded to " .. var.KILLER_NAME .. " for killing " .. var.TARGET_NAME .. ". " .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. var.TARGET_LEVEL .. " by " .. var.KILLER_NAME .. " who was level " .. var.KILLER_LEVEL .. " at the time. " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "(Unjustified)" or "(Justified)"))
					end
 
					doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_RED)
				end
			elseif(isCreature(deathList[i]) == TRUE) then
			doItemSetAttribute(item, 'description',"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..getCreatureName(deathList[i])..".")
			else
			doItemSetAttribute(item, 'description',"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid)..".")
			end
		doItemSetAttribute(item, "name", ""..getPlayerName(cid).."\'s Heart")
		end
	end
	return true
end
 
Hello guys. I tested this script and it works really good. I was able to modify it and now the heart goes into the player's backpack. But know I want to know if someone could edit the script and make 2 things...

Being able to restrict when the PK player gets the heart something like "You don't get a Heart for killing player under lvl 100"

And the other is restrict a player from getting a heart for killing a player with the same IP.

Thanks in advance!
 
Back
Top