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

Need Help (Random Box)

Teddy

SweStream.se
Joined
Oct 2, 2008
Messages
3,797
Reaction score
10
Location
Sweden 172
Hello Guys
i need some help
i need a script that make a box after whit actionID tex(9999)
if you klick on the box it come "sound" effect ingame.. and after 1-2 sex u will get a random item
and u can only take in the box ever 12 H (for 1 char)
if u have play COD 5 World at war (Nazi zombie) u will understand more ..
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local box = {
		storage = 12345,
		items = {
			{2160, 1},
			{2152, 100},
			{2148, 14}
		}
	}
	if (exhaustion.get(cid, box.storage) == false) then
		local rand = math.random(1, #box.items)
		addEvent(doPlayerAddItem, 2 * 1000, cid, box.items[rand][1], box.items[rand][2])
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_SOUND_GREEN)
		exhaustion.set(cid, box.storage, 12 * 60 * 1000)
	else
		doPlayerSendCancel(cid, "You can't use this box.")
	end
	return true
end
 
Chojrak rocks :thumbup:

Edit:
Hope you don't mind if I make this "multiple" and make a thread.
Credits to you!
 
Last edited:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local box = {
		storage = 12345,
		items = {
			{2160, 1},
			{2152, 100},
			{2148, 14}
		}
	}
	if (exhaustion.get(cid, box.storage) == false) then
		local rand = math.random(1, #box.items)
		addEvent(doPlayerAddItem, 2 * 1000, cid, box.items[rand][1], box.items[rand][2])
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_SOUND_GREEN)
		exhaustion.set(cid, box.storage, 12 * 60 * 1000)
	else
		doPlayerSendCancel(cid, "You can't use this box.")
	end
	return true
end
so its set to 12 H right ?
exhaustion.set(cid, box.storage, 12 * 60 * 1000)

+

items = {
{2160, 1},
{2152, 100},
{2148, 14}

Item ID , % to drop right ?
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local box = {
		storage = 12345,
		items = {
			{2160, 1},
			{2152, 100},
			{2148, 14}
		}
	}
	if (exhaustion.get(cid, box.storage) == false) then
		local rand = math.random(1, #box.items)
		addEvent(doPlayerAddItem, 2 * 1000, cid, box.items[rand][1], box.items[rand][2])
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_SOUND_GREEN)
		exhaustion.set(cid, box.storage, 12 * 60 * 1000)
	else
		doPlayerSendCancel(cid, "You can't use this box.")
	end
	return true
end
How do i fix so its come in a orange text over the char .. ?
+
how do i make so its a 10 % on 1 item and 90% on an other .. ?
+
you can stand on the box , how do i fix that
 
1:
Code:
doCreatureSay(cid, "text", TALKTYPE_MONSTER)

2:
Play arround with math.random()

3:
Use not walkable item, or create movements which push your player back.

Last question
Added this
else
doCreatureSay(cid, "You Need To Wait 12H Before You Can Take In The Random Box Again!", TALKTYPE_MONSTER)
end
and the player can spam on it .. can i add downtime some way?
 
Back
Top