ADD 1 BACKPACK INSIDE IT HAS 42 BACKPACK CONTAINING 100 SCARAB COIN IN 42 BACKPACK INSIDE IF YOU HAVE SPACE IN INVENTORY
If you don't have space in the inventory container slot, backpack, don't pick up the items
You need to have space in your inventory to pick it up and use it in your chest.
Lua:
function onUse(cid, item, frompos, item2, topos)
if item.uid == 1624 then
if getPlayerStorageValue(cid, 1624) == -1 then
if getPlayerLevel(cid) >= 0 then
local enoughSpace = true
-- Checks if there is enough space for all the backpacks
for i = 1, 42 do
if not doPlayerAddItem(cid, 10518, 1) then
enoughSpace = false
break
end
end
if enoughSpace then
-- Adds 1000 coins (ID 2159) inside a backpack (ID 10518) and repeats 100 times
for i = 1, 100 do
local backpack = doCreateItemEx(10518, 1)
if backpack ~= 0 then
for j = 1, 42 do
doAddContainerItem(backpack, 2159, 1000)
end
doPlayerAddItemEx(cid, backpack, false)
else
doPlayerSendCancel(cid, "You don't have enough space for the backpacks.")
return true
end
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have won a prize.")
setPlayerStorageValue(cid, 1624, 1)
else
doPlayerSendCancel(cid, "You don't have enough space for the backpacks.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to be level 717217 to use.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already received the bonus.")
end
end
return true
end
If you don't have space in the inventory container slot, backpack, don't pick up the items
You need to have space in your inventory to pick it up and use it in your chest.
Last edited: