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

50% loot rate for players vip

LUA:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Premium Loot Rate" version="1.0" author="Cykotitan" contact="otland.net" enabled="yes">
	<event type="kill" name="plr" event="script"> <![CDATA[
local premRate = 7 -- loot rate for premium players
 
local rate = getConfigInfo('rateLoot') -- the normal rate, don't change
 
function getContentDescription(uid, comma)
	local ret, i, containers = '', 0, {}
	while i < getContainerSize(uid) do
		local v, s = getContainerItem(uid, i), ''
		local k = getItemInfo(v.itemid)
		if k.name ~= '' then
			if v.type > 1 and k.stackable and k.showCount then
				s = v.type .. ' ' .. getItemInfo(v.itemid).plural
			else
				local article = k.article
				s = (article == '' and '' or article .. ' ') .. k.name
			end
			ret = ret .. (i == 0 and not comma and '' or ', ') .. s
			if isContainer(v.uid) and getContainerSize(v.uid) > 0 then
				table.insert(containers, v.uid)
			end
		else
			ret = ret .. (i == 0 and not comma and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster'
		end
		i = i + 1
	end
	for i = 1, #containers do
		ret = ret .. getContentDescription(containers[i], true)
	end
	return ret
end
 
local function send(cid, pos, corpseid, monster, party)
	local corpse = getTileItemById(pos, corpseid).uid
	local ret = isContainer(corpse) and getContentDescription(corpse)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'))
	if party then
		for _, pid in ipairs(getPartyMembers(party)) do
			doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY)
		end
	end
end
 
local function createLoot(i, ext)
	local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id
	local random = math.ceil(math.random(100000) / (ext and premRate or rate))
	local tmpItem
 
	if random < i.chance then
		tmpItem = doCreateItemEx(item, getItemInfo(item).stackable and random % i.count + 1 or 1)
	end
 
	if not tmpItem then
		return
	end
 
	if i.subType ~= -1 then
		doItemSetAttribute(tmpItem, 'subType', i.subType)
	end
 
	if i.actionId ~= -1 then
		doItemSetAttribute(tmpItem, 'aid', i.actionId)
	end
 
	if i.uniqueId ~= -1 then
		doItemSetAttribute(tmpItem, 'uid', i.uniqueId)
	end
 
	if i.text ~= '' then
		doItemSetAttribute(tmpItem, 'text', i.text)
	end
 
	return tmpItem
end
 
local function createChildLoot(parent, i, ext)
	if #i == 0 then
		return true
	end
 
	local size, cap = 0, getContainerCap(parent)
	for k = 1, #i do
		if size == cap then
			break
		end
		local tmp = createLoot(i[k], ext)
		if tmp then
			if isContainer(tmp) then
				if createChildLoot(tmp, i[k].child, ext) then
					doAddContainerItemEx(parent, tmp)
					size = size + 1
				else
					doRemoveItem(tmp)
				end
			else
				doAddContainerItemEx(parent, tmp)
				size = size + 1
			end
		end
	end
 
	return size > 0
end
 
local function dropLoot(pos, v, ext)
	local corpse = getTileItemById(pos, v.lookCorpse).uid
	if isContainer(corpse) then
		for i = 1, getContainerSize(corpse) do
			doRemoveItem(getContainerItem(corpse, 0).uid)
		end
		local size, cap = 0, getContainerCap(corpse)
		for i = 1, #v.loot do
			if size == cap then
				break
			end
			local tmp = createLoot(v.loot[i], ext)
			if tmp then
				if isContainer(tmp) then
					if createChildLoot(tmp, v.loot[i].child, ext) then
						doAddContainerItemEx(corpse, tmp)
						size = size + 1
					else
						doRemoveItem(tmp)
					end
				else
					doAddContainerItemEx(corpse, tmp)
					size = size + 1
				end
			end
		end
	end
end
 
function onKill(cid, target, damage, flags)
	if isInArray({1,3}, flags) and isMonster(target) then
		local v = getMonsterInfo(getCreatureName(target))
		if v.lookCorpse > 0 then
			local master = getCreatureMaster(target)
			if not master or master == target then
				addEvent(dropLoot, 0, getThingPos(target), v, vip.hasVip(cid))
			end
			addEvent(send, 100, cid, getThingPos(target), v.lookCorpse, v.description, getPlayerParty(cid))
		end
	end
	return true
end
	]]></event>
<event type="login" name="Premium Loot Rate" event="buffer"><![CDATA[
	registerCreatureEvent(cid, 'plr')
]]></event>
</mod>

credits 100% cykotitan(theBest) :P

test it and tell me
 
on conf.lua lootrate = 0

and all players rate 0 xD!!

or test lootrate = 1 and premrate = 500, and all players give same loot :C

- - - Updated - - -

achieve that worked with the original script: http://otland.net/f163/mod-loot-ring-99748/

just replace: getPlayerSlotItem(cid, t.slot).itemid == t.item

by this line: getPlayerStorageValue(cid, 9898) == 1

but I have a problem, :(

VIP PLAYER SEND THIS:
Code:
14:21 You deal 65 damage to a rotworm.
14:21 Loot of a rotworm: 9 gold coins, 4 worms, 8 gold coins
14:21 Loot of a rotworm: a bag, a copper shield, a legion helmet, 3 gold coins, 4 worms, 3 gold coins, a katana, a sword, a mace, ham, meat

if it gives the correct loot, but sends regular loot message and message with loot vip :(

NOT VIP PLAYERS SEND THIS:
Code:
14:31 You deal 65 damage to a rotworm.
14:31 Loot of a rotworm: 5 gold coins, 20 gold coins
14:31 Loot of a rotworm: a bag, a gold coin, 17 gold coins, ham


14:31 You deal 65 damage to a rotworm.
14:31 Loot of a rotworm: 11 gold coins, a worm, 12 gold coins
14:31 Loot of a rotworm: 11 gold coins, a worm, 12 gold coins


on my conf.lua have THIS:
Code:
	monsterLootMessage = 0

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Loot Ring" version="1.0" author="Cykotitan" contact="otland.net" enabled="yes">
	<event type="kill" name="lootring" event="script"> <![CDATA[
local t = {
	item = 2179,
	slot = CONST_SLOT_RING,
	newRate = 500.0
}
 
local rate = getConfigInfo('rateLoot')
 
function getContentDescription(uid, comma)
	local ret, i, containers = '', 0, {}
	while i < getContainerSize(uid) do
		local v, s = getContainerItem(uid, i), ''
		local k = getItemInfo(v.itemid)
		if k.name ~= '' then
			if v.type > 1 and k.stackable and k.showCount then
				s = v.type .. ' ' .. getItemInfo(v.itemid).plural
			else
				local article = k.article
				s = (article == '' and '' or article .. ' ') .. k.name
			end
			ret = ret .. (i == 0 and not comma and '' or ', ') .. s
			if isContainer(v.uid) and getContainerSize(v.uid) > 0 then
				table.insert(containers, v.uid)
			end
		else
			ret = ret .. (i == 0 and not comma and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster'
		end
		i = i + 1
	end
	for i = 1, #containers do
		ret = ret .. getContentDescription(containers[i], true)
	end
	return ret
end
 
local function send(cid, pos, corpseid, monster, party)
	local corpse = getTileItemById(pos, corpseid).uid
	local ret = isContainer(corpse) and getContentDescription(corpse)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'))
	if party then
		for _, pid in ipairs(getPartyMembers(party)) do
			doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY)
		end
	end
end
 
local function createLoot(i, ext)
	local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id
	local random = math.ceil(math.random(100000) / (ext and t.newRate or rate))
	local tmpItem
 
	if random < i.chance then
		tmpItem = doCreateItemEx(item, getItemInfo(item).stackable and random % i.count + 1 or 1)
	end
 
	if not tmpItem then
		return
	end
 
	if i.subType ~= -1 then
		doItemSetAttribute(tmpItem, 'subType', i.subType)
	end
 
	if i.actionId ~= -1 then
		doItemSetAttribute(tmpItem, 'aid', i.actionId)
	end
 
	if i.uniqueId ~= -1 then
		doItemSetAttribute(tmpItem, 'uid', i.uniqueId)
	end
 
	if i.text ~= '' then
		doItemSetAttribute(tmpItem, 'text', i.text)
	end
 
	return tmpItem
end
 
local function createChildLoot(parent, i, ext)
	if #i == 0 then
		return true
	end
 
	local size, cap = 0, getContainerCap(parent)
	for k = 1, #i do
		if size == cap then
			break
		end
		local tmp = createLoot(i[k], ext)
		if tmp then
			if isContainer(tmp) then
				if createChildLoot(tmp, i[k].child, ext) then
					doAddContainerItemEx(parent, tmp)
					size = size + 1
				else
					doRemoveItem(tmp)
				end
			else
				doAddContainerItemEx(parent, tmp)
				size = size + 1
			end
		end
	end
 
	return size > 0
end
 
local function dropLoot(pos, v, ext)
	local corpse = getTileItemById(pos, v.lookCorpse).uid
	if isContainer(corpse) then
		for i = 1, getContainerSize(corpse) do
			doRemoveItem(getContainerItem(corpse, 0).uid)
		end
		local size, cap = 0, getContainerCap(corpse)
		for i = 1, #v.loot do
			if size == cap then
				break
			end
			local tmp = createLoot(v.loot[i], ext)
			if tmp then
				if isContainer(tmp) then
					if createChildLoot(tmp, v.loot[i].child, ext) then
						doAddContainerItemEx(corpse, tmp)
						size = size + 1
					else
						doRemoveItem(tmp)
					end
				else
					doAddContainerItemEx(corpse, tmp)
					size = size + 1
				end
			end
		end
	end
end
 
function onKill(cid, target, lastHit)
	if lastHit and isMonster(target) then
		local v = getMonsterInfo(getCreatureName(target))
		if v.lookCorpse > 0 then
			local master = getCreatureMaster(target)
			if not master or master == target then
			addEvent(dropLoot, 0, getThingPos(target), v, getPlayerStorageValue(cid, 9898) == 1)
			end
			addEvent(send, 100, cid, getThingPos(target), v.lookCorpse, v.description, getPlayerParty(cid))
		end
	end
	return true
end
	]]></event>
 <event type="login" name="Loot Ring" event="buffer"><![CDATA[
		registerCreatureEvent(cid, "lootring")
	]]></event>
</mod>

- - - Updated - - -

AND ORIGINAL SCRIPT 50% RATE LOOT FOR PREMMIUM DONT WORK XD
 
oooh shiit, yeeh i have this mod. disable?XD

- - - Updated - - -

finally working 100% thanks for your help = P
 
Back
Top