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

OTClient Problem use runes in yourself

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
151
Reaction score
9
i can't use runes on myself, i got this msg there.

You are not allowed to shoot directly on players.

how can i fix this?
 
I cant remember what I did to fix this but il get you started

game_interface interface.lua
Code:
function onUseWith(clickedWidget, mousePosition)
  if clickedWidget:getClassName() == 'UIGameMap' then
    local tile = clickedWidget:getTile(mousePosition)
    if tile then
      if selectedThing:isFluidContainer() or selectedThing:isMultiUse() then
        g_game.useWith(selectedThing, tile:getTopMultiUseThing())
      else
        g_game.useWith(selectedThing, tile:getTopUseThing())
      end
    end
  elseif clickedWidget:getClassName() == 'UIItem' and not clickedWidget:isVirtual() then
    g_game.useWith(selectedThing, clickedWidget:getItem())
  elseif clickedWidget:getClassName() == 'UICreatureButton' then
    local creature = clickedWidget:getCreature()
    if creature then
      g_game.useWith(selectedThing, creature)
    end
  end
end

in OTClient tile.cpp start at line 398, its one of the getTop~ lines.


Im guessing you dont want ppl to use hotkeys?
 
I cant remember what I did to fix this but il get you started

game_interface interface.lua
Code:
function onUseWith(clickedWidget, mousePosition)
  if clickedWidget:getClassName() == 'UIGameMap' then
    local tile = clickedWidget:getTile(mousePosition)
    if tile then
      if selectedThing:isFluidContainer() or selectedThing:isMultiUse() then
        g_game.useWith(selectedThing, tile:getTopMultiUseThing())
      else
        g_game.useWith(selectedThing, tile:getTopUseThing())
      end
    end
  elseif clickedWidget:getClassName() == 'UIItem' and not clickedWidget:isVirtual() then
    g_game.useWith(selectedThing, clickedWidget:getItem())
  elseif clickedWidget:getClassName() == 'UICreatureButton' then
    local creature = clickedWidget:getCreature()
    if creature then
      g_game.useWith(selectedThing, creature)
    end
  end
end

in OTClient tile.cpp start at line 398, its one of the getTop~ lines.


Im guessing you dont want ppl to use hotkeys?

Yeah, i need fix this, because my server is old school... then i dont want ppl to use hotkeys.
but i have this problem ;s
 
i can't use runes on myself, i got this msg there.

You are not allowed to shoot directly on players.

how can i fix this?
In tibia client when you use an item on a player it uses playerUseItemEx instead of playerUseWithCreature. If you are using a 7.92 and below server and this fix does work for you as well then let me know and I'll create a pull request on the otclient repo.

So if you replace this line:
otland/otclient (https://github.com/otland/otclient/blob/eb4fd24a311169fa4955506be9d2d13b1a92aacc/src/client/game.cpp#L865)

With this:
C++:
if(toThing->isCreature() && !toThing->isPlayer())

And replace this function:
otland/otclient (https://github.com/otland/otclient/blob/eb4fd24a311169fa4955506be9d2d13b1a92aacc/modules/game_interface/gameinterface.lua#L411)

With this:
Lua:
function onUseWith(clickedWidget, mousePosition)
  if clickedWidget:getClassName() == 'UIGameMap' then
    local tile = clickedWidget:getTile(mousePosition)
    if tile then
      if selectedThing:isFluidContainer() or selectedThing:isMultiUse() then
        g_game.useWith(selectedThing, tile:getTopMultiUseThing())
      else
        g_game.useWith(selectedThing, tile:getTopUseThing())
      end
    end
  elseif clickedWidget:getClassName() == 'UIItem' and not clickedWidget:isVirtual() then
    g_game.useWith(selectedThing, clickedWidget:getItem())
  elseif clickedWidget:getClassName() == 'UICreatureButton' then
    local creature = clickedWidget:getCreature()
    if creature then
      if creature:isPlayer() then
        g_game.useInventoryItemWith(selectedThing:getId(), creature)
      else
        g_game.useWith(selectedThing, creature)
      end
    end
  end
end
 
This was a very nice fix, please try and add it to the main branch of OTC.

Any idea on how to completely remove the "pick item for hotkey" feature?
Since in oldschool you couldn't hotkey items.
 
Back
Top