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

Script monsterLootMessage Plzz

tibiek

Banned User
Joined
Jun 3, 2009
Messages
320
Reaction score
0
Location
Poland
i have tfs 0.3.4 8.42 and i dont messageloot on monsters kill ;/ plz script or idk
 
posting in a dead thread

Code:
function getContentDescription(uid, comma)
	local ret, i = '', 0
	while i < getContainerSize(uid) do
		local v, descr = getContainerItem(uid, i), ''
		if v.type > 1 and isItemStackable(v.itemid) then
			descr = v.type .. ' ' .. getItemDescriptionsById(v.itemid).plural
		else
			descr = getItemDescriptionsById(v.itemid).article .. ' ' .. getItemNameById(v.itemid)
		end
		ret = ret .. (i == 0 and not comma and '' or ', ') .. descr
		if isContainer(v.uid) and getContainerSize(v.uid) ~= 0 then
			ret = ret .. getContentDescription(v.uid, true)
		end
		i = i + 1
	end
	return ret
end

local function send(cid, pos, corpseid, monster)
	local corpse, ret = getTileItemById(pos, corpseid).uid, ''
	if isContainer(corpse) then
		ret = getContentDescription(corpse)
	end
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of a ' .. monster .. ': ' .. (ret == '' and 'nothing' or ret))
end

function onKill(cid, target)
	local monster = getCreatureName(target)
	if not isPlayer(target) and getMonsterInfo(monster).lookCorpse > 0 then
		addEvent(send, 100, cid, getThingPos(target), getMonsterInfo(monster).lookCorpse, monster)
	end
	return true
end
 
Last edited:
Back
Top