BR
bug - poketibia

[Encerrado] (Bug) Auto Loot

Por BrunooMaciell, 22 de jul. de 2013 em Tópicos Sem Resposta

resolvido
script
25
2.8k
BrunooMaciellB
22 de julho de 2013 às 21:09

Estou com um bug no meu auto loot quem puder ajudar ^^

 

BUG

 

[22/07/2013 21:01:17] [Error - TalkAction Interface]
[22/07/2013 21:01:17] data/talkactions/scripts/aloot.lua:onSay
[22/07/2013 21:01:17] Description:
[22/07/2013 21:01:17] data/talkactions/scripts/aloot.lua:8: attempt to index local 'action' (a nil value)
[22/07/2013 21:01:17] stack traceback:
[22/07/2013 21:01:17] data/talkactions/scripts/aloot.lua:8: in function

 

 

SCRIPT

 

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, 'Você já tem ' .. limit .. ' autolooting itens.')
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, 'Este item não pode se adicionado no autoloot lista.')
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, 'Este item não pode se adicionado no autoloot lista.')
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) .. '<< Foi adicionado à lista autoloot.')
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, 'Você não tem nenhum item adicionado.')
end
local item = tonumber(rst)
if not item then
item = getItemIdByName(rst, false)
if not item then
return doPlayerSendCancel(cid, 'Este item não existi.')
end
end
if not isInArray(list, item) then
return doPlayerSendCancel(cid, 'Este item não está na lista.')
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) .. '<< Removido da lista autoloot.')
end
return true
end

 

 

Curti+

KluivertK
22 de julho de 2013 às 21:14

Vc uso o meu scripter???

BrunooMaciellB
22 de julho de 2013 às 21:18

a cara nem sie de quem usei mais quem puder ajuda no bug ta aii ^^

KluivertK
22 de julho de 2013 às 21:22

Se vc nn uso o meu entao tente !!!

 

 

 

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, 'Você já tem ' .. limit .. ' autolooting itens.')
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, 'Este item não pode se adicionado no autoloot lista.')
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, 'Este item não pode se adicionado no autoloot lista.')
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) .. '<< Foi adicionado à lista autoloot.')
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, 'Você não tem nenhum item adicionado.')
end
local item = tonumber(rst)
if not item then
item = getItemIdByName(rst, false)
if not item then
return doPlayerSendCancel(cid, 'Este item não existi.')
end
end
if not isInArray(list, item) then
return doPlayerSendCancel(cid, 'Este item não está na lista.')
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) .. '<< Removido da lista autoloot.')
end
return true
end

22 de julho de 2013 às 21:25

to jogando server dele e o auto loot ta bugado :s aew klui ajuda ele awee :S

KluivertK
22 de julho de 2013 às 21:27

Sim vo tentar !!!

BrunooMaciellB
22 de julho de 2013 às 21:57

continua bugado =/

KluivertK
23 de julho de 2013 às 17:58

1:Va em Data/Talkactions/Scripts e crie um aquivo lua com nome de "aloot" e ponho 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, 'Você já tem ' .. limit .. ' autolooting itens.')
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, 'Este item não pode se adicionado no autoloot lista.')
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, 'Este item não pode se adicionado no autoloot lista.')
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) .. '<< Foi adicionado à lista autoloot.')
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, 'Você não tem nenhum item adicionado.')
end
local item = tonumber(rst)
if not item then
item = getItemIdByName(rst, false)
if not item then
return doPlayerSendCancel(cid, 'Este item não existi.')
end
end
if not isInArray(list, item) then
return doPlayerSendCancel(cid, 'Este item não está na lista.')
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) .. '<< Removido da lista autoloot.')
end
return true
end

 

 

 

 

2: Va em Data/Talkactions e bote la na parte do playrs isso.

 

 

 

<talkaction words="/aloot" hide="yes" event="script" value="aloot.lua"/>

 

 

 

3: Va em Data/Creaturescripts/Scripts fala um arquivo lua com nome de aloot e ponha isso la dentro.

 

 

 

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

 

 

 

 

4: Va em creaturescripts.xml e ponha o seguinte tag:

 

 

 

<event type="login" name="aloot_reg" event="script" value="aloot.lua"/>


<event type="kill" name="aloot_kill" event="script" value="aloot.lua"/>

 

 

23 de julho de 2013 às 18:08

esse é certeza que pega klui?

picapau100P
23 de julho de 2013 às 19:23

KluiMaster

esse dai ainda tem aquele bug ¬¬

exemplo: adc o water gem

ai o aloot pegou 100 dele

ai depois que vim esse water gem ne algum corpo de algum poke

ele nao pega mais rsrsrs

Editado Julho 23 por picapau100

23 de julho de 2013 às 19:31

Acho que este bug é do Clone? não é?

KluivertK
24 de julho de 2013 às 09:31

Mano creio que esse nn tem bug testeo ae !!!

24 de julho de 2013 às 09:36

klui master tem skype ou facebook ?

kttallanK
24 de julho de 2013 às 23:39

Brunno arruma um scrpter pra tu fais muita pergunta tenta esse aki fais = do klui so troca o creatureeventes ai se der bug me avisa nao testei..

 

 

 

 

function onDeath(cid, corpse, killer)

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

BrunooMaciellB
28 de julho de 2013 às 10:59

eu testeio agora do eduardobean << acho que e assim que escreve !!

 

o auto loot dele tbem ta bugado =/

 

vou ver o seus agora !!


Klui

 

o seu tbem ta bugado !!

 

eu lembro um que nao tava antes que chegarao a postarao que tinha uma linha que tu adiciona no login.lua

Editado Julho 28 por Brunnoo