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

7.6 Avesta script

Erevius

It Was A Good Day
Joined
Feb 12, 2010
Messages
157
Reaction score
7
Location
Poland/Olsztyn
Siemka. Chciałbym przerobić ten skrypt, tak aby działał na 7.6 Avesta ale nie mam pojęcia jak.
Więc oto mój prosty skrypcik, który potem sam rozbuduję:
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

Jak widać, skrypt ma dać szanse na zdobycie nagrody, jaką są 3 różne paczki itemków:
Czy można ominąć ten sposób z wymienianiem kolejno wszystkich itemków:
Code:
doAddContainerItem(bag, <id>, <type>)
doAddContainerItem(bag, <id>, <type>)
doAddContainerItem(bag, <id>, <type>)

Może da rade użyć pętle "for"?:
Code:
for i=1, numberofitems do
	doAddContainerItem(bag, <ids>, <types>)
end

Za pomoc REP++!

#Down
O to mi właśnie chodziło. Dzięki wielkie.
 
Last edited:
tablicą możesz skrócić, ale wymienić id i tak musisz, jeżeli nie są kolejno, np.
LUA:
local items = {
	{id=2472, count = 1},
	{id=2160, count = 24},

}

for _,i in ipairs(items) do
	doAddContainerItem(bag, i.id, i.count)
end
 
Back
Top