• 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 Chest System Multi-Item support.

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Well the script was requested by Slaktaren here, so I made the script, and I thought it would be usefull for many people, so I'm posting it here :rolleyes:.

The script supports multiple items
LUA:
local chests = {
	[8560] = {storage = 1000, items = {1234, 1235, 1236},count={1,2}},
	[8561] = {storage = 1001, items = {2412, 3431},count={1,2}},
	[8562] = {storage = 1002, items = {3531, 9481, 3987, 9313},count={1,2,5,1}},
	--[UNIQUEID] = {storage = 1003, items = {3531, 9481, 3987, 9313},count={1,2,5,1}}, Apply the uniqueid to the chest and register it in actions.xml, add items in an array {ITEMID,ITEMID2}, in the count array add how many of the item you want {ITEMID_COUNT,ITEMID2_COUNT}, rest is self speaking.
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local l,lc = {},0
local v = chests[item.uid]
	if v then
		if getCreatureStorage(cid, v.storage) ~= 1 then
			for i = 1,#v.items do
				lc = (getItemWeightById(v.items[i])*v.count[i])+lc
			end
			if getPlayerFreeCap(cid) >= lc then
				doCreatureSetStorage(cid, v.storage, 1)
				for i = 1,#v.items do
					doPlayerAddItem(cid,v.items[i],v.count[i])
					table.insert(l,getItemNameById(v.items[i]))
				end
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You found these item(s): '..table.concat(l,', ')..'.')
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have enough capiticity!")
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
		end
	end
return true
end

Scripted for 0.3.x, untested so report any errors.

Enjoy,
unknown666
 
Last edited:
You wrote it. OK.
I just want to say that you should not post scripts that already exist and are better then yours [your is bugged, may not give items, you check capacity, but what if player doesn't have place in backpack?]. Now someone will make map/script that use your scripts. After year someone will download his map and it will not be compatible with TFS/any server.
I don't want to say that you should not write scripts. Each your new script is better, really, but post in request section, not in 'releases'.
 
You wrote it. OK.
I just want to say that you should not post scripts that already exist and are better then yours [your is bugged, may not give items, you check capacity, but what if player doesn't have place in backpack?]. Now someone will make map/script that use your scripts. After year someone will download his map and it will not be compatible with TFS/any server.
I don't want to say that you should not write scripts. Each your new script is better, really, but post in request section, not in 'releases'.

cool story bro.
 
[but what if player doesn't have place in backpack?]

Then I'm afraid he'll have to cry at his mother :'(

and it will not be compatible with TFS/any server.

Bullshit? It's compatible for 0.3.x and also with tfs 0.4.

I don't want to say that you should not write scripts. Each your new script is better, really, but post in request section, not in 'releases'

I've seen many requests about this type of script, I just think about other people, not just myself and money.


Consider this as a bump, and I felt like commenting because I'm bored.
 
Last edited:
Back
Top