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

Lua Script for Avesta 7.6

Erevius

It Was A Good Day
Joined
Feb 12, 2010
Messages
157
Reaction score
7
Location
Poland/Olsztyn
Dear OTLanders.
I'd like to make that script below works on 7.6 Avesta but I have no f*** idea how to.
So here is the basic script I want to rebuild later:
Code:
function onUse(cid, item, frompos, item2, topos)
	bagid = 1997
	itemspack1 = {{2139, 1},{2148, 100}}
	itemspack2 = {{2170, 1},{2152, 3}}
	itemspack3 = {{2174, 1},{2160, 1}}
	
	if getPlayerStorageValue(cid, item.uid) >= 1 then
		los = math.random(1,6)
		if los == 1
			bag = doPlayerAddItem(cid, bagid, 1)
			doAddContainerItem(bag, itemspack1[1], itemspack1[2]) -- (bag, itemid, subType/count)
			doPlayerSendTextMessage(cid, 22, "You have found ".. getItemDescriptions(bagid).article .." ".. getItemDescriptions(bagid).name ..".")
		elseif los == 2
			doAddContainerItem(bag, itemspack2[1], itemspack2[2]) -- (bag, itemid, subType/count)
			doPlayerSendTextMessage(cid, 22, "You have found ".. getItemDescriptions(bagid).article .." ".. getItemDescriptions(bagid).name ..".")
		elseif los == 3
			doAddContainerItem(bag, itemspack1[1], itemspack1[2]) -- (bag, itemid, subType/count)
			doPlayerSendTextMessage(cid, 22, "You have found ".. getItemDescriptions(bagid).article .." ".. getItemDescriptions(bagid).name ..".")
		else
			doPlayerSendTextMessage(cid, 22, "Missed")
		end
end
	return 1
end

As you can see I want the script to give a chance to win a reward which is a bag with 3 different item packs.
Is it possible to avoid something like this?:
Code:
doAddContainerItem(bag, <id>, <type>)
doAddContainerItem(bag, <id>, <type>)
doAddContainerItem(bag, <id>, <type>)

Hmm... Maybye:
Code:
for i=1, numberofitems do
	doAddContainerItem(bag, <ids>, <types>)
end

Please help me! (REP++)
 
Back
Top