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

TFS 1.X+ Autoloot TFS 1.3

Pedrook

Advanced OT User
Joined
May 24, 2009
Messages
442
Solutions
3
Reaction score
183
Location
Brazil
Hello, I have an autoloot and I'm having difficulty adapting it to modal window.

I do not even want to adapt the add part, because I think it takes longer, I just wanted the remove part, with the autoloots listed and the player was going to select and click the remove button, and if you add another clean button all over the autoloot.



already tried in several ways, including pulling the db but I did not succeed.

Lua:
local query = db.storeQuery("SELECT `autoloot_list` FROM player_autoloot WHERE `player_id` = "..player:getGuid())
   if not query then
       return 0
   end






Here goes the remove moon that I currently use.


Lua:
function onSay(player, words, param)
   local itemType = ItemType(param)

   if itemType:getId() == 0 then
       itemType = ItemType(tonumber(param))
       if itemType:getName() == '' then
           player:sendCancelMessage("There is no item with that id or name.")
           return false
       end
   end

   if player:getAutoLootItem(itemType:getId()) then
       player:removeAutoLootItem(itemType:getId())
       player:sendTextMessage(MESSAGE_INFO_DESCR, "You're not auto looting " .. itemType:getName() .. " anymore.")
   else
       player:sendCancelMessage("You're not autolooting this item.")
   end

   return false
end

Lua:
function onModalWindow(player, modalWindowId, buttonId, choiceId) 
    player:unregisterEvent("ModalWindow_Tutorial")
   
    local list = "You're auto looting: "
    local alist = player:getAutoLootList()
    if alist then
        for _, item in ipairs(alist) do
            list = list .. (ItemType(item)):getName() .. ", "
        end
    else
        player:sendCancelMessage("The list is empty.")
        return false
    end
    player:sendTextMessage(MESSAGE_INFO_DESCR, list:sub(1, -3))
 
    if modalWindowId == 1000 then
        if buttonId == 100 then

        end
    end
end


pOBRjR8.png
 
Last edited by a moderator:
Back
Top