Ecstacy
Mothafuckaaa
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
.
The script supports multiple items
Scripted for 0.3.x, untested so report any errors.
Enjoy,
unknown666

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: