Auto loot e um sistema para o servidor não tem relação com o OTC Sessão errada amigo da uma procurada por Scripts que e capas de vc achar eu tinha esse sistema aqui se eu achar eu posto pra vc falow
o do pxg até tem sim, ele tem um efeito dos items e quantidade que são pegos aparecendo no topo da tela, mas da pra fazer sem isso
mas acho que eles criaram um callback novo, provavelmente um onOpenContainer, não sei se da pra fazer daquela forma por onUse
info
Grupo: Campones
Registrado: 11/04/13
Posts: 72
Reputação: +24

Vai em data/talkactions/scripts e adiciona um arquivo.lua e renomeie para aloot e cole isso dentro :
local stor, limit = 7575, 5 --storage, limit to add.
local allow_container = false --empty! not looted with items, atleast for now.
function onSay(cid, words, param)
local expl = param:explode(':')
local action, rst = expl[1], expl[2]
if (action:lower() == 'check') then
local infos, list = getPlayerStorageValue(cid, stor), {}
if (infos ~= -1) then
list = tostring(infos):explode(',')
end
local txt = 'Autoloot List:\n'
if (#list > 0) then
for k, id in ipairs(list) do
id = id:gsub('_', '')
if tonumber(id) then
txt = txt .. getItemNameById(tonumber(id)) .. ((k < #list) and '\n' or '')
end
end
else
txt = 'Empty'
end
doPlayerPopupFYI(cid, txt)
elseif (action:lower() == 'add') then
local infos, list = getPlayerStorageValue(cid, stor), {}
if (infos ~= -1) then
list = tostring(infos):gsub('_', ''):explode(',')
end
if (#list >= limit) then
return doPlayerSendCancel(cid, 'You already have ' .. limit .. ' autolooting items.')
end
local item = tonumber(rst)
if not item then
item = getItemIdByName(rst, false)
if not item then
return doPlayerSendCancel(cid, 'Esse item nao existe.')
end
end
if not allow_container and isItemContainer(item) then
return doPlayerSendCancel(cid, 'this item can not be autolooted.')
end
local attrs = getItemInfo(item)
if not attrs then
return doPlayerSendCancel(cid, 'Esse item nao existe.')
elseif not attrs.movable or not attrs.pickupable then
return doPlayerSendCancel(cid, 'this item can not be autolooted.')
end
if isInArray(list, item) then
return doPlayerSendCancel(cid, 'Ja foi adicionado.')
end
table.insert(list, tostring(item))
local new = ''
for v, id in ipairs(list) do
new = new .. '_' .. id:gsub('_' ,'') .. ((v < #list) and ',' or '')
end
doPlayerSetStorageValue(cid, stor, tostring(new))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById(item) .. '<< has been added to the autoloot list.')
elseif (action:lower() == 'remove') then
local infos, list = getPlayerStorageValue(cid, stor), {}
if (infos ~= -1) then
list = tostring(infos):gsub('_', ''):explode(',')
end
if (#list == 0) then
return doPlayerSendCancel(cid, 'You dont have any item added.')
end
local item = tonumber(rst)
if not item then
item = getItemIdByName(rst, false)
if not item then
return doPlayerSendCancel(cid, 'not valid item.')
end
end
if not isInArray(list, item) then
return doPlayerSendCancel(cid, 'This item is not in the list.')
end
local new = ''
for v, id in ipairs(list) do
if (tonumber(id) ~= item) then
new = new .. '_' .. id:gsub('_' ,'') .. ((v < #list) and ',' or '')
end
end
doPlayerSetStorageValue(cid, stor, tostring(new))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById(item) .. '<< removed from the autoloot list.')
end
return true
end
Agora vai em data/talkactions/talkactions.xml e adicione está tag :
<talkaction words="/aloot" hide="yes" event="script" value="aloot.lua"/>
No /aloot é o comando que o player vai usar se quiser pode mudar...
Agr vá em data/creaturescripts/creaturescripts.xml e adicione essa tag:
<event type="login" name="aloot_reg" event="script" value="aloot.lua"/>
<event type="kill" name="aloot_kill" event="script" value="aloot.lua"/>
Agr crie um arquivo .lua e com nome de aloot e coloque isso dentro e salve dentro da pasta creaturescripts/scripts.
function onLogin(cid)
registerCreatureEvent(cid, "aloot_kill")
return true
end
local stor = 7575
function autoloot(cid, target, pos)
local function doStack(cid, itemid, new)
local count = getPlayerItemCount(cid, itemid)
if (count > 100) then
count = count - math.floor(count / 100) * 100
end
local newCount = count + new
if (count ~= 0) then
local find = getPlayerItemById(cid, true, itemid, count).uid
if (find > 0) then
doRemoveItem(find)
else
newCount = new
end
end
local item = doCreateItemEx(itemid, newCount)
doPlayerAddItemEx(cid, item, true)
end
local function scanContainer(cid, uid, list)
for k = (getContainerSize(uid) - 1), 0, -1 do
local tmp = getContainerItem(uid, k)
if (isInArray(list, tmp.itemid)) then
if isItemStackable(tmp.itemid) and (getPlayerItemCount(cid, tmp.itemid) > 0) then
doStack(cid, tmp.itemid, tmp.type)
else
local item = doCreateItemEx(tmp.itemid, tmp.type)
doPlayerAddItemEx(cid, item, true)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Looted ' .. tmp.type .. ' ' .. getItemNameById(tmp.itemid) .. '.')
doRemoveItem(tmp.uid)
elseif isContainer(tmp.uid) then
scanContainer(cid, tmp.uid, list)
end
end
end
local items = {}
for i = getTileInfo(pos).items, 1, -1 do
pos.stackpos = i
table.insert(items, getThingFromPos(pos))
end
if (#items == 0) then
return
end
local corpse = -1
for _, item in ipairs(items) do
local name = getItemName(item.uid):lower()
if name:find(target:lower()) then
corpse = item.uid
break
end
end
if (corpse ~= -1) and isContainer(corpse) then
scanContainer(cid, corpse, tostring(getPlayerStorageValue(cid, stor)):gsub('_', ''):explode(','))
end
end
function onKill(cid, target, lastHit)
if not isPlayer(target) then
local infos = getPlayerStorageValue(cid, stor)
if (infos == -1) then
return true
end
local list = tostring(infos):explode(',')
if (#list == 0) then
return true
end
addEvent(autoloot, 150, cid, getCreatureName(target), getCreaturePosition(target))
end
return true
end
Agora vá em data/globalevents/scripts e adicione um arquivo.lua e renomeie para aloot e coloque isso dentro :
function onThink(interval, lastExecution)
-- Configurações
local cor = 25 -- Defina a cor da mensagem (25 = verde)
local mensagens ={
[[sistema de autoloot, para você ativar você digita /aloot add: nomedoitem --- e para remover um item voce digita /aloot remove: nomedoitem --- para ver os loots /aloot check]]
}
-- Fim de Configurações
doBroadcastMessage(mensagens[math.random(1,table.maxn(mensagens))], cor)
return TRUE
end
Agora vai em data/globalevents/globalevents.xml e cole está tag :
<globalevent name="aloot" interval="500" event="script" value="aloot.lua"/>
Ajudei ? Rep ++
info
Grupo: Artesão
Registrado: 30/03/13
Posts: 124
Reputação: +21
Char no Tibia: Two One Two

Vlw, funciono Rep+
Erro.
[14/04/2013 15:51:52] [Error - TalkAction Interface]
[14/04/2013 15:51:52] data/talkactions/scripts/aloot.lua:onSay
[14/04/2013 15:51:52] Description:
[14/04/2013 15:51:52] data/talkactions/scripts/aloot.lua:6: attempt to index local 'action' (a nil value)
[14/04/2013 15:51:52] stack traceback:
[14/04/2013 15:51:52] data/talkactions/scripts/aloot.lua:6: in function <data/talkactions/scripts/aloot.lua:3>
Essse erro acontece caso o player nao digite algo apenas /aloot tem deixo de arrumar isso.
Editado Abril 14 por nociam
info
Grupo: Campones
Registrado: 11/04/13
Posts: 72
Reputação: +24

Esse erro é porque deve ser de outro bixo tipow outland ou outro bixo que você adicionou ¬¬
Meus trabalhos :
Esse erro e quanto o player digita somente /aloot sem o resto .
info
Grupo: Campones
Registrado: 16/03/13
Posts: 12
Reputação: 0

rep+ mais vc consegue fazer 1 pra funciona na outland nao?




info
Grupo: Artesão
Registrado: 30/03/13
Posts: 124
Reputação: +21
Char no Tibia: Two One Two
Como na PxG tem o Auto Loot, queria saber como eu coloco o Auto Loot aqui no meu OtClient