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

Arrow slot OTClient

eyez

Member
Joined
Oct 11, 2016
Messages
129
Reaction score
19
On OTclient you can replace your weapons on hands...
Right/Left

But i play paladin with BOW/CROSSBOW

So i create a new condition to arrow slot...
But how to get arrow slot to complete my code?

Code:
elseif AfkModule.getPanel():getChildById('AutoReplaceWeaponSelect'):getText() == "Arrow Slot" then
hand = InventorySlotRight

/modules/01-afk/events/replacehands.lua
Code:
--[[
  @Authors: Ben Dol (BeniS)
  @Details: Auto replace hands event logic
]]

AfkModule.AutoReplaceHands = {}
AutoReplaceHands = AfkModule.AutoReplaceHands

function AutoReplaceHands.Event(event)
  if g_game.isOnline() then
    local player = g_game.getLocalPlayer()

    local selectedItem = AfkModule.getPanel():getChildById('ItemToReplace'):getItem():getId()
    local item = player:getItem(selectedItem)
   
    local hand = InventorySlotOther
    if AfkModule.getPanel():getChildById('AutoReplaceWeaponSelect'):getText() == "Left Hand" then
      hand = InventorySlotLeft
    elseif AfkModule.getPanel():getChildById('AutoReplaceWeaponSelect'):getText() == "Right Hand" then
      hand = InventorySlotRight
    elseif AfkModule.getPanel():getChildById('AutoReplaceWeaponSelect'):getText() == "Arrow Slot" then
      hand = InventorySlotRight
    end
    local handPos = {['x'] = 65535, ['y'] = hand, ['z'] = 0}

    local handItem = player:getInventoryItem(hand)
    if handItem and handItem:getCount() > 3 then
      return 10000
    end

    if item and (not handItem or handItem:getId() ~= item:getId()) then
      g_game.move(item, handPos, item:getCount())
    end
  end

  return Helper.safeDelay(500, 1500)
end
 
Replace under:

Lua:
elseif AfkModule.getPanel():getChildById('AutoReplaceWeaponSelect'):getText() == "Arrow Slot" then

this:
Lua:
hand = InventorySlotRight
to:
Lua:
hand = InventorySlotAmmo
 
Replace under:

Lua:
elseif AfkModule.getPanel():getChildById('AutoReplaceWeaponSelect'):getText() == "Arrow Slot" then

this:
Lua:
hand = InventorySlotRight
to:
Lua:
hand = InventorySlotAmmo

Thank you so much!

Admins there is no best answer here? I want to give to him....
 
Last edited:
It's the only answer anyways.
 
Maybe change this:
Lua:
if handItem and handItem:getCount() > 10 then
    return 10000
end
to:
Lua:
if handItem and handItem:getCount() > 10 then
    return 2000
end
 
Back
Top