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

Actions: When click Box get random reward

YugiNao

Banned User
Joined
Nov 22, 2008
Messages
211
Reaction score
3
I need a script for
Code:
Actions
,
When click the box: id 9661 getting a random item.
 
Code:
local t = {
	{1, 36},
	{37, 46, 2148, 80},
	{47, 55, 2148, 50},
	{56, 64, 2671, 5},
	{65, 73, 2789, 5},
	{74, 81, 7620},
	{82, 87, 7618},
	{88, 92, 9811},
	{93, 96, 9808},
	{97, 100, 2213}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (os.time() - getPlayerStorageValue(cid, 65000)) >= 3600 then
		setPlayerStorageValue(cid, 65000, os.time())
		local rand = math.random(100)
		for i = 1, #t do
			local k = t[i]
			if rand >= k[1] and rand <= k[2] then
				if k[3] then
					local itemid, count, article = k[3], k[4] or 1, getItemInfo(itemid).article
					doPlayerAddItem(cid, itemid, count)
					doCreatureSay(cid, count > 1 and "You found " .. count .. " " .. getItemInfo(itemid).plural .. "." or "You found " .. (article ~= "" and (article .. " ") or "") .. getItemInfo(itemid).name .. ".", TALKTYPE_ORANGE_1)
				else
					doCreatureSay(cid, "You found nothing useful.", TALKTYPE_ORANGE_1)
				end
				break
			end
		end
	else
		doCreatureSay(cid, "You found nothing useful.", TALKTYPE_ORANGE_1)
	end
	return true
end
 
Back
Top