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

Action Getting items from stones with pick

DanJ93

Member
Joined
Dec 25, 2008
Messages
212
Reaction score
19
Code:
--[[ 
Author: [URL="http://otland.net/members/DanJ93/"]DanJ93[/URL] & [URL="http://otland.net/members/Oskar1121/"]Oskar1121[/URL]
--]] 
local config = {
				[1294] = {[COLOR="#008000"]2493, 2494, 2495, 7891[/COLOR]}, -- small stone
				[2145] = {[COLOR="#008000"]2493, 2494, 2495, 7891[/COLOR]}, -- small diamond
				[2146] = {[COLOR="#008000"]2493, 2494, 2495, 7891[/COLOR]}, -- small sapphire
				[2147] = {[COLOR="#008000"]2493, 2494, 2495, 7891[/COLOR]}, -- small ruby
				[2149] = {[COLOR="#008000"]2493, 2494, 2495, 7891[/COLOR]}, -- small emerald
				[2150] = {[COLOR="#008000"]2493, 2494, 2495, 7891[/COLOR]} -- small amethyst
				}
				
local items = {}
for item, _ in pairs(config) do
	table.insert(items, item)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local teksty = {'Nothing was hidden in ' .. getItemNameById(itemEx.itemid) .. '', 'You deal to much hit, ' .. getItemNameById(itemEx.itemid) .. 'be destroyed', 'Nothing was in ' .. getItemNameById(itemEx.itemid) .. '', 'You dropped ' .. getItemNameById(itemEx.itemid) .. ' which is damaged'}
local tekst = math.random(1, #teksty)
if config[itemEx.itemid] then
	local itemek = config[itemEx.itemid][math.random(1, #config[itemEx.itemid])]
	if math.random(100) <= 33 then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'The blow was too light to split' .. getItemNameById(itemEx.itemid) .. '.')
	end
	if math.random(100) <= 14 then
		doRemoveItem(item.uid, 1)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You destroyed ' .. getItemNameById(item.itemid) .. '.')
	end
	doRemoveItem(itemEx.uid, 1)
	if math.random(100) <= 4 then
		doRemoveItem(item.uid, 1)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You destroyed ' .. getItemNameById(item.itemid) .. ' and ' .. getItemNameById(itemEx.itemid) .. '.')
	end
	if math.random(100) <= 13 then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, '' .. teksty[tekst] .. '.')
	end
	if math.random(100) <= 20 then
		doPlayerAddItem(cid, itemek)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found ' .. getItemNameById(itemek) .. ', but ' .. getItemNameById(item.itemid) .. ' was destroyed!')
		return doRemoveItem(item.uid, 1)
	else
		doPlayerAddItem(cid, itemek)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found ' .. getItemNameById(itemek) .. '!')
	end
else 
	local x = ''
	for i = 1, #items do
		x = x .. getItemNameById(items[i]) .. (i < #items-1 and ', ' or i == #items-1 and ' or ' or '.')
	end
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You must use ' .. getItemNameById(item.itemid) .. ' on one of these stones: ' .. x) 
end 
return true 
end
2493, 2494, 2495, 7891 - To edit.
 
Cloud you tell anything more? Does it destroy stone? For each item is the same chance? What about making "picking level"?
 
Back
Top