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

Action Message of items inside a bp.

leyendario

kind of scripter
Joined
Aug 1, 2009
Messages
49
Reaction score
14
Location
Venezuela
Message of items inside a bp.
it send a message to the player when open the backpack/bag or any other item-container type if you want to.

actions.xml
Code:
<action itemid="1988" event="script" value="bp.lua"/>
add any other bp/bag id that you want to have this function.


bp.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition) -- script by leyendario
   local a, b, counter = getContainerSize(item.uid) or nil, "", 0
   if a ~= nil then
      for i = 0, a do
         local c = getContainerItem(item.uid, i)
         if c.itemid ~= 0 then
            if c.type > 1 then
               if b == "" then
                  b = c.type .." ".. getItemPluralNameById(c.itemid)
               else
                  b = b ..", ".. c.type .." ".. getItemPluralNameById(c.itemid)
               end
               counter = 1
            else
               if b ~= "" then
                  b = b ..", ".. getItemNameById(c.itemid)
               else
                  b = getItemNameById(c.itemid)
               end
               counter = 1
            end
         end
      end
      if b ~= "" then
         if counter > 0 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'You have these items : '.. b ..'.')
         else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'You have this item : '.. b ..'.')
         end
      end
   end
end

bpmensaje.jpg
 
What happen if you have more bp's inside with items? ;)
it just tells you that there's a backpack.. I did not want the script go through all the backpacks that the player could possible have inside of another bp, becouse of the mass spam that could generate.
 
Well just tested it and the backpack which i have on bp slot was already opened when i click on it to close it make the check i guess it just have to check when u r opening the backpack not closing it :p
 
it just tells you that there's a backpack.. I did not want the script go through all the backpacks that the player could possible have inside of another bp, becouse of the mass spam that could generate.

This. I can already imagine the abuse people would do with this to crash servers LOL.

Still rep ++, very useful script :)
 
Well just tested it and the backpack which i have on bp slot was already opened when i click on it to close it make the check i guess it just have to check when u r opening the backpack not closing it :p
don't know if it's possible to check whether it's open or closed, could be a clientsided UI thing
 
Back
Top