Ir para conteúdo
  • 0

[Resolvido] [AJUDA] Autoloot


viimalagogin

Pergunta

Olá pessoal, eu tenho esse script de autoloot no meu servidor e ele funciona POR PARTES.

• Funciona apenas recolhimento dos Golds, Mais Slots para players premium ou não.

 

• Não funciona o recolhimento dos items, qualquer que seja o item, ele manda mensagem falando que não existe. "THIS ITEM DOES NOT EXIST"

 

Gostaria que ele recolhesse todos os items normalmente!

 

Eu uso esse script MODS abaixo:

<?xml version="1.0" encoding="ISO-8859-1"?><mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes"><config name="Loot_func"><![CDATA[info = {	AutomaticDeposit = true,	BlockMonsters = {},	BlockItemsList = {2123,2515},	Max_Slots = {free = 2, premium = 5},	Storages = {27000,28001,28002}}function setPlayerStorageTable(cid, storage, tab)	local tabstr = "&"	for i,x in pairs(tab) do		tabstr = tabstr .. i .. "," .. x .. ";"	end	setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))endfunction getPlayerStorageTable(cid, storage)	local tabstr = getPlayerStorageValue(cid, storage)	local tab = {}	if type(tabstr) ~= "string" then		return {}	end	if tabstr:sub(1,1) ~= "&" then		return {}	end	local tabstr = tabstr:sub(2, #tabstr)	local a = string.explode(tabstr, ";")	for i,x in pairs(a) do		local b = string.explode(x, ",")		tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]	end	return tabendfunction isInTable(cid, item)	for _,i in pairs(getPlayerStorageTable(cid, info.Storages[1]))do		if tonumber(i) == tonumber(item) then			return true		end	end	return falseendfunction addItemTable(cid, item)	local x = {}	for i = 1,#getPlayerStorageTable(cid, info.Storages[1]) do		table.insert(x,getPlayerStorageTable(cid, info.Storages[1])[i])	end	if x ~= 0 then		table.insert(x,tonumber(item))		setPlayerStorageTable(cid, info.Storages[1], x)	else		setPlayerStorageTable(cid, info.Storages[1], {item})	endendfunction removeItemTable(cid, item)	local x = {}	for i = 1,#getPlayerStorageTable(cid, info.Storages[1]) do		table.insert(x,getPlayerStorageTable(cid, info.Storages[1])[i])	end	for i,v in ipairs(x) do		if tonumber(v) == tonumber(item) then			table.remove(x,i)		end	end	return setPlayerStorageTable(cid, info.Storages[1], x)endfunction ShowItemsTabble(cid)	local n,str = 0,"[+] Auto Loot Commands [+]\n\n!autoloot item name --> To add ou Remove item from list.\n!autoloot money --> To collect gold automatically.\n!autoloot clear --> To clear the list.\n!autoloot on/off --> To enable or disable the collecting of items in the system.\n\n[+] Auto Loot Info [+]\n\nSystem: "..(getPlayerStorageValue(cid, info.Storages[3]) <= 0 and "Activated" or "Disabled")..".\nGold Collecting: "..(getPlayerStorageValue(cid, info.Storages[2]) > 0 and "Activated" or "Disabled")..".\nBalance Total: ["..getPlayerBalance(cid).."] gp's.\nMaximum Slots: ["..#getPlayerStorageTable(cid, info.Storages[1]).."/"..(isPremium(cid) and info.Max_Slots.premium or info.Max_Slots.free).."]\n\n[+] Auto Loot Slots [+]\n\n"	for i = 1,#getPlayerStorageTable(cid, info.Storages[1]) do		n = n + 1		str = str.."Slot "..n.." - "..getItemNameById(getPlayerStorageTable(cid, info.Storages[1])[i]).."\n"	end	return doPlayerPopupFYI(cid, str)endfunction getContainerItems(containeruid)	local items = {}	local containers = {}	if type(getContainerSize(containeruid)) ~= "number" then		return false	end	for slot = 0, getContainerSize(containeruid)-1 do		local item = getContainerItem(containeruid, slot)		if item.itemid == 0 then			break		end		if isContainer(item.uid) then			table.insert(containers, item.uid)		end		table.insert(items, item)	end	if #containers > 0 then		for i,x in ipairs(getContainerItems(containers[1])) do			table.insert(items, x)		end		table.remove(containers, 1)	end	return itemsendfunction getItemsInContainerById(container, itemid) -- Function By Kydrai	local items = {}	if isContainer(container) and getContainerSize(container) > 0 then		for slot=0, (getContainerSize(container)-1) do			local item = getContainerItem(container, slot)			if isContainer(item.uid) then				local itemsbag = getItemsInContainerById(item.uid, itemid)				for i=0, #itemsbag do					table.insert(items, itemsbag[i])				end			else				if itemid == item.itemid then					table.insert(items, item.uid)				end			end		end	end	return itemsendfunction doPlayerAddItemStacking(cid, itemid, amount) -- revisado	local item, _G = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid), 0	if #item > 0 then		for _ ,x in pairs(item) do			local ret = getThing(x)			if ret.type < 100 then				doTransformItem(ret.uid, itemid, ret.type+amount) 				if ret.type+amount > 100 then					doPlayerAddItem(cid, itemid, ret.type+amount-100)				end				break			else				_G = _G+1			end		end		if _G == #item then			doPlayerAddItem(cid, itemid, amount)		end	else		return doPlayerAddItem(cid, itemid, amount)	endendfunction AutomaticDeposit(cid,item,n)	local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)	return doPlayerDepositMoney(cid, deposit)endfunction corpseRetireItems(cid, pos)	local check = false	for i = 0, 255 do		pos.stackpos = i		tile = getTileThingByPos(pos)		if tile.uid > 0 and isCorpse(tile.uid) then			check = true break		end	end	if check == true then		local items = getContainerItems(tile.uid)		for i,x in pairs(items) do			if isInArray(getPlayerStorageTable(cid, info.Storages[1]), tonumber(x.itemid)) or getPlayerStorageValue(cid, info.Storages[2]) > 0 and isInArray({2148,2152,2160},tonumber(x.itemid)) then				if isItemStackable(x.itemid) then					doPlayerAddItemStacking(cid, x.itemid, x.type)					if info.AutomaticDeposit == true and isInArray({2148,2152,2160}, tonumber(x.itemid)) then						AutomaticDeposit(cid,x.itemid,x.type)					end				else					doPlayerAddItem(cid, x.itemid)				end				doRemoveItem(x.uid)			end		end	endend]]></config><event type="login" name="LootLogin" event="script"><![CDATA[function onLogin(cid)	registerCreatureEvent(cid, "LootEventKIll")	if isPremium(cid) and getPlayerStorageValue(cid, 27001) <= 0 then		setPlayerStorageValue(cid, 27001, 1)	elseif getPlayerStorageValue(cid, 27001) > 0 and not isPremium(cid) then		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Auto Loot] You premium is Over, Start a new list!")		setPlayerStorageValue(cid, 27001, -1)		setPlayerStorageValue(cid, info.Storages[1], -1)	end	return trueend]]></event><event type="kill" name="LootEventKIll" event="script"><![CDATA[domodlib('Loot_func')function onKill(cid, target, lastHit) 	if isPlayer(cid) and getPlayerStorageValue(cid, info.Storages[3]) <= 0 and isMonster(target) and not isInArray(info.BlockMonsters, getCreatureName(target):lower()) then		addEvent(corpseRetireItems, 0, cid ,getThingPos(target))	end	return trueend]]></event><talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[domodlib('Loot_func')local param, slots = param:lower(), isPremium(cid) and info.Max_Slots.premium or info.Max_Slots.freeif not param or param == "" then	ShowItemsTabble(cid) return trueelseif tonumber(param) then	doPlayerSendCancel(cid, "enter commands: !autoloot item name [+] !autoloot clean [+] !autoloot money [+] !autoloot on/off") return trueelseif isInArray({"clean","limpar", "clear"}, param) then	setPlayerStorageValue(cid, info.Storages[1], -1)	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Auto Loot] Your list has been cleaned.") return trueelseif isInArray({"start","stop","on","off"}, param) then	setPlayerStorageValue(cid, info.Storages[3], getPlayerStorageValue(cid, info.Storages[3]) <= 0 and 1 or 0)	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Auto Loot] "..(getPlayerStorageValue(cid, info.Storages[3]) > 0 and "Stopped" or "Started")..".") return trueelseif isInArray({"money","gold","gps","dinheiro"}, param) then	setPlayerStorageValue(cid, info.Storages[2], getPlayerStorageValue(cid, info.Storages[2]) <= 0 and 1 or 0)	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Auto Loot] Gold Colleting "..(getPlayerStorageValue(cid, info.Storages[2]) > 0 and "Activated" or "disabled")..".") return trueendlocal item = getItemIdByName(param, false)if not item then	doPlayerSendCancel(cid, "This item does not exist.") return trueendlocal var = isInTable(cid, item)if isInArray({2148,2152,2160},item) then 	doPlayerSendCancel(cid, "Enter !autoloot money to add money in your list!") return true	elseif isInArray(info.BlockItemsList, item) then	doPlayerSendCancel(cid, "You can not add this item in the list!") return trueelseif not var and #getPlayerStorageTable(cid, info.Storages[1]) >= slots then	doPlayerSendCancel(cid, "max "..slots.." from auto loot") return trueendif not var then	addItemTable(cid, item)else	removeItemTable(cid, item)enddoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,not var and "you added the item "..param.." in the list" or "you removed the item "..param.." from the list")return true]]></talkaction></mod>

 

QUALQUER TIPO DE AJUDA, OU SOLUÇÃO EU DOU +REP!!! OBRIGADO!!!

Editado por viimalagogin
Link para o comentário
Compartilhar em outros sites

15 respostass a esta questão

Posts Recomendados

  • 1
2 minutos atrás, viimalagogin disse:

@Dragon Ball Hiper OTX amigo

certo .

teste ...

 

  1. <?xml version="1.0" encoding="ISO-8859-1"?>  
  2. <mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
  3. <config name="Loot_func"><![CDATA[
  4.         info = {
  5.             OnlyPremium = true,
  6.             AutomaticDeposit = true,
  7.             BlockMonsters = {},
  8.             BlockItemsList = {2123,2515}
  9.             }
  10.  
  11. function setPlayerStorageTable(cid, storage, tab)
  12.     local tabstr = "&"
  13.     for i,x in pairs(tab) do
  14.             tabstr = tabstr .. i .. "," .. x .. ";"
  15.     end
  16.     setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
  17. end
  18. function getPlayerStorageTable(cid, storage)
  19.     local tabstr = getPlayerStorageValue(cid, storage)
  20.     local tab = {}
  21.     if type(tabstr) ~= "string" then
  22.             return {}
  23.     end
  24.     if tabstr:sub(1,1) ~= "&" then
  25.             return {}
  26.     end
  27.     local tabstr = tabstr:sub(2, #tabstr)
  28.     local a = string.explode(tabstr, ";")
  29.     for i,x in pairs(a) do
  30.             local b = string.explode(x, ",")
  31.             tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
  32.     end
  33.     return tab
  34. end
  35. function ExistItemByName(name) -- by vodka
  36.     local items = io.open("data/items/items.xml", "r"):read("*all")
  37.     local get = items:match('name="' .. name ..'"')
  38.     if get == nil or get == "" then
  39.         return false
  40.     end
  41. return true
  42. end
  43. function isInTable(cid, item)
  44.          for _,i in pairs(getPlayerStorageTable(cid, 27000))do
  45.              if tonumber(i) == tonumber(item) then
  46.                 return true
  47.              end
  48.          end
  49. return false
  50. end
  51. function addItemTable(cid, item)
  52.          local x = {}
  53.                for i = 1,#getPlayerStorageTable(cid, 27000) do
  54.                    table.insert(x,getPlayerStorageTable(cid, 27000))
               end
               if x ~= 0 then
                  table.insert(x,tonumber(item))
                  setPlayerStorageTable(cid, 27000, x)
               else
                   setPlayerStorageTable(cid, 27000, {item})
               end
end
function removeItemTable(cid, item)
         local x = {}
               for i = 1,#getPlayerStorageTable(cid, 27000) do
                   table.insert(x,getPlayerStorageTable(cid, 27000))
               end
               for i,v in ipairs(x) do
                   if tonumber(v) == tonumber(item) then
                   table.remove(x,i)
               end
               end
         return setPlayerStorageTable(cid, 27000, x)
end
function ShowItemsTabble(cid)
local str,n = "-- My Loot List --\n\n",0
for i = 1,#getPlayerStorageTable(cid, 27000) do
n = n + 1
str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"
end
return doShowTextDialog(cid, 2529, str)
end
function getContainerItems(containeruid)
    local items = {}
    local containers = {}
    if type(getContainerSize(containeruid)) ~= "number" then
            return false
    end
    for slot = 0, getContainerSize(containeruid)-1 do
            local item = getContainerItem(containeruid, slot)
            if item.itemid == 0 then
                    break
            end
            if isContainer(item.uid) then
                    table.insert(containers, item.uid)
            end
            table.insert(items, item)
    end
    if #containers > 0 then
            for i,x in ipairs(getContainerItems(containers[1])) do
                    table.insert(items, x)
            end
            table.remove(containers, 1)
    end    
    return items
end
function getItemsInContainerById(container, itemid) -- Function By Kydrai
            local items = {}
            if isContainer(container) and getContainerSize(container) > 0 then
                            for slot=0, (getContainerSize(container)-1) do
                                            local item = getContainerItem(container, slot)
                                            if isContainer(item.uid) then
                                                            local itemsbag = getItemsInContainerById(item.uid, itemid)
                                                            for i=0, #itemsbag do
                                                                            table.insert(items, itemsbag)
                                                            end
                                            else
                                                            if itemid == item.itemid then
                                                                            table.insert(items, item.uid)
                                                            end
                                            end
                            end
            end
            return items
end
function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
    local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid)
    local piles = 0
    if #item > 0 then
            for i,x in pairs(item) do
                    if getThing(x).type < 100 then
                            local it = getThing(x)
                            doTransformItem(it.uid, itemid, it.type+quant)
                            if it.type+quant > 100 then
                                    doPlayerAddItem(cid, itemid, it.type+quant-100)
                            end
                    else
                           piles = piles+1
                    end
            end
    else
            return doPlayerAddItem(cid, itemid, quant)
    end
    if piles == #item then
            doPlayerAddItem(cid, itemid, quant)
    end
end
function AutomaticDeposit(cid,item,n)
local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
return doPlayerDepositMoney(cid, deposit)
end
function corpseRetireItems(cid, pos)
    local check = false
    for i = 0, 255 do
    pos.stackpos = i
    tile = getTileThingByPos(pos)
        if tile.uid > 0 and isCorpse(tile.uid) then
            check = true break
        end
end
        if check == true then
            local items = getContainerItems(tile.uid)
                for i,x in pairs(items) do
                        if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
                                if isItemStackable(x.itemid) then
                        doPlayerAddItemStacking(cid, x.itemid, x.type)
                        if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
                        AutomaticDeposit(cid,x.itemid,x.type)
                        end
                                else
                                        doPlayerAddItem(cid, x.itemid)
                                end
                                    doRemoveItem(x.uid)
                        end
                end
        end
end
]]></config>
<event type="login" name="LootLogin" event="script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "MonsterAttack")
return true
end]]></event>
<event type="death" name="LootEventDeath" event="script"><![CDATA[
domodlib('Loot_func')
    function onDeath(cid, corpse, deathList)
    local killer,pos = deathList[1],getCreaturePosition(cid)
    addEvent(corpseRetireItems,1,killer,pos)
return true
end]]></event>
<event type="combat" name="MonsterAttack" event="script"><![CDATA[
domodlib('Loot_func')
        if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
            registerCreatureEvent(target, "LootEventDeath")
                        end
return true]]></event>
<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[
domodlib('Loot_func')
local t = string.explode(string.lower(param), ",")
if info.OnlyPremium == true and not isPremium(cid) then
doPlayerSendCancel(cid, "you must be a premium account.") return true
elseif not t[1] then
ShowItemsTabble(cid) return true
elseif tonumber(t[1]) or tonumber(t[2]) then
doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name") return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
local item = ExistItemByName(tostring(t[2]))
if not item then
doPlayerSendCancel(cid, "This item does not exist.") return true
end
local itemlist = getItemIdByName(tostring(t[2]))
if check == true and isInArray(info.BlockItemsList, itemlist) then
doPlayerSendCancel(cid, "You can not add this item in the list!") return true
elseif isInTable(cid, itemlist) == check then
doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.") return true
end
func(cid, itemlist)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>
 

Link para o comentário
Compartilhar em outros sites

  • 0

@Dragon Ball Hiper Ele funfou meio bugado. Eu consigo adicionar o item pra recolher, porem depois eu nao consigo abrir mais a janela pra ver a lista de items e nem remover. Usei os seguintes comandos: !autoloot ---- !autoloot add, worms ----- !autoloot remove, worms

Link para o comentário
Compartilhar em outros sites

  • 0
34 minutos atrás, viimalagogin disse:

@Dragon Ball Hiper Ele funfou meio bugado. Eu consigo adicionar o item pra recolher, porem depois eu nao consigo abrir mais a janela pra ver a lista de items e nem remover. Usei os seguintes comandos: !autoloot ---- !autoloot add, worms ----- !autoloot remove, worms

olá fiz os teste e esta normal , nao esta usando nenhum talkactions que esta afetando nao ?

Link para o comentário
Compartilhar em outros sites

  • 0

Esta dando este erro na distro pra ser mais específico:

Description:data/lib/100-shortcut.lua:260: attempt to index a boolean value

Nao tem nenhuma outra talkaction relacionada ao autoloot no servidor, apenas essa do script adicionada :s

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, viimalagogin disse:

Esta dando este erro na distro pra ser mais específico:

Description:data/lib/100-shortcut.lua:260: attempt to index a boolean value

Nao tem nenhuma outra talkaction relacionada ao autoloot no servidor, apenas essa do script adicionada :s

teste a original  100-shortcut.lua

 

 

 

 

 

 

function doPlayerSendToChannel(cid, target, type, text, channel, time)

    return doCreatureChannelSay(cid, target, text, type, channel)

end

 

function getItemWeaponType(uid)

    local thing = getThing(uid)

    if(thing.itemid < 100) then

        return false

    end

 

    return getItemInfo(thing.itemid).weaponType

end

 

function getItemRWInfo(uid)

    local thing = getThing(uid)

    if(thing.itemid < 100) then

        return false

    end

 

    local item, flags = getItemInfo(thing.itemid), 0

    if(item.readable) then

        flags = 1

    end

 

    if(item.writable) then

        flags = flags + 2

    end

 

    return flags

end

 

function getItemLevelDoor(itemid)

    local item = getItemInfo(itemid)

    return item and item.levelDoor or false

end

 

function isContainer(uid)

    local thing = getThing(uid)

    return thing.uid > 0 and thing.items ~= nil

end

 

function isItemStackable(itemid)

    local item = getItemInfo(itemid)

    return item and item.stackable or false

end

 

function isItemRune(itemid)

    local item = getItemInfo(itemid)

    return item and item.type == ITEM_TYPE_RUNE or false

end

 

function isItemDoor(itemid)

    local item = getItemInfo(itemid)

    return item and item.type == ITEM_TYPE_DOOR or false

end

 

function isItemContainer(itemid)

    local item = getItemInfo(itemid)

    return item and item.group == ITEM_GROUP_CONTAINER or false

end

 

function isItemFluidContainer(itemid)

    local item = getItemInfo(itemid)

    return item and item.group == ITEM_GROUP_FLUID or false

end

 

function isItemMovable(itemid)

    local item = getItemInfo(itemid)

    return item and item.movable or false

end

 

function isCorpse(uid)

    local thing = getThing(uid)

    if(thing.itemid < 100) then

        return false

    end

 

    local item = getItemInfo(thing.itemid)

    return item and item.corpseType ~= 0 or false

end

 

function getContainerCapById(itemid)

    local item = getItemInfo(itemid)

    if(not item or item.group ~= 2) then

        return false

    end

 

    return item.maxItems

end

 

function getMonsterAttackSpells(name)

    local monster = getMonsterInfo(name)

    return monster and monster.attacks or false

end

 

function getMonsterHealingSpells(name)

    local monster = getMonsterInfo(name)

    return monster and monster.defenses or false

end

 

function getMonsterLootList(name)

    local monster = getMonsterInfo(name)

    return monster and monster.loot or false

end

 

function getMonsterSummonList(name)

    local monster = getMonsterInfo(name)

    return monster and monster.summons or false

end

 

function doItemSetActionId(uid, aid)

    return doItemSetAttribute(uid, "aid", aid)

end

 

function getFluidSourceType(itemid)

    local item = getItemInfo(itemid)

    return item and item.fluidSource or false

end

 

function getDepotId(uid)

    return getItemAttribute(uid, "depotid") or false

end

 

function getItemDescriptions(uid)

    local thing = getThing(uid)

    if(thing.itemid < 100) then

        return false

    end

 

    local item = getItemInfo(thing.itemid)

    return {

        name = getItemAttribute(uid, "name") or item.name,

        plural = getItemAttribute(uid, "pluralname") or item.plural,

        article = getItemAttribute(uid, "article") or item.article,

        special = getItemAttribute(uid, "description") or "",

        text = getItemAttribute(uid, "text") or "",

        writer = getItemAttribute(uid, "writer") or "",

        date = getItemAttribute(uid, "date") or 0

    }

end

 

function doRemoveThing(uid)

    if(isCreature(uid)) then

        return doRemoveCreature(uid)

    end

 

    return doRemoveItem(uid)

end

 

function setAttackFormula(combat, type, minl, maxl, minm, maxm, min, max)

    local min, max = min or 0, max or 0

    return setCombatFormula(combat, type, -1, 0, -1, 0, minl, maxl, minm, maxm, -min, -max)

end

 

function setHealingFormula(combat, type, minl, maxl, minm, maxm, min, max)

    local min, max = min or 0, max or 0

    return setCombatFormula(combat, type, 1, 0, 1, 0, minl, maxl, minm, maxm, min, max)

end

 

function doChangeTypeItem(uid, subtype)

    local thing = getThing(uid)

    if(thing.itemid < 100) then

        return false

    end

 

    local subtype = subtype or 1

    return doTransformItem(thing.uid, thing.itemid, subtype)

end

 

function doPlayerResetIdleTime(cid)

    return doPlayerSetIdleTime(cid, 0)

end

 

function doPlayerSetExperienceRate(cid, value)

    return doPlayerSetRate(cid, SKILL__LEVEL, value)

end

 

function doPlayerSetMagicRate(cid, value)

    return doPlayerSetRate(cid, SKILL__MAGLEVEL, value)

end

 

function isSummon(cid)

    return getCreatureMaster(cid) and getCreatureMaster(cid) ~= cid

end

 

function getPartyLeader(cid)

    local party = getPartyMembers(cid)

    if(type(party) ~= 'table') then

        return 0

    end

 

    return party[1]

end

 

function isInParty(cid)

    return type(getPartyMembers(cid)) == 'table'

end

 

function doShutdown()

    return doSetGameState(GAMESTATE_SHUTDOWN)

end

 

function getPlayerGroupName(cid)

    return getGroupInfo(getPlayerGroupId(cid)).name

end

 

function getPlayerVocationName(cid)

    return getVocationInfo(getPlayerVocation(cid)).name

end

 

function getPromotedVocation(vid)

    return getVocationInfo(vid).promotedVocation

end

 

function doPlayerRemovePremiumDays(cid, days)

    return doPlayerAddPremiumDays(cid, -days)

end

 

function getPlayerMasterPos(cid)

    return getTownTemplePosition(getPlayerTown(cid))

end

 

function getHouseOwner(houseId)

    return getHouseInfo(houseId).owner

end

 

function getHouseName(houseId)

    return getHouseInfo(houseId).name

end

 

function getHouseEntry(houseId)

    return getHouseInfo(houseId).entry

end

 

function getHouseRent(houseId)

    return getHouseInfo(houseId).rent

end

 

function getHousePrice(houseId)

    return getHouseInfo(houseId).price

end

 

function getHouseTown(houseId)

    return getHouseInfo(houseId).town

end

 

function getHouseDoorsCount(houseId)

    return table.maxn(getHouseInfo(houseId).doors)

end

 

function getHouseBedsCount(houseId)

    return table.maxn(getHouseInfo(houseId).beds)

end

 

function getHouseTilesCount(houseId)

    return table.maxn(getHouseInfo(houseId).tiles)

end

 

function getItemNameById(itemid)

    return getItemDescriptionsById(itemid).name

end

 

function getItemPluralNameById(itemid)

    return getItemDescriptionsById(itemid).plural

end

 

function getItemArticleById(itemid)

    return getItemDescriptionsById(itemid).article

end

 

function getItemName(uid)

    return getItemDescriptions(uid).name

end

 

function getItemPluralName(uid)

    return getItemDescriptions(uid).plural

end

 

function getItemArticle(uid)

    return getItemDescriptions(uid).article

end

 

function getItemText(uid)

    return getItemDescriptions(uid).text

end

 

function getItemSpecialDescription(uid)

    return getItemDescriptions(uid).special

end

 

function doSetItemSpecialDescription(uid, str)

    return doItemSetAttribute(uid, "description", str)

end

 

function getItemWriter(uid)

    return getItemDescriptions(uid).writer

end

 

function getItemDate(uid)

    return getItemDescriptions(uid).date

end

 

function getTilePzInfo(pos)

    return getTileInfo(pos).protection

end

 

function getTileZoneInfo(pos)

    local tmp = getTileInfo(pos)

    if(tmp.pvp) then

        return 2

    end

 

    if(tmp.nopvp) then

        return 1

    end

 

    return 0

end

 

function playerExists(name, multiworld)

    return getPlayerGUIDByName(name, multiworld or false) ~= nil

end

 

function doPlayerWithdrawAllMoney(cid)

    return doPlayerWithdrawMoney(cid, getPlayerBalance(cid))

end

 

function doPlayerDepositAllMoney(cid)

    return doPlayerDepositMoney(cid, getPlayerMoney(cid))

end

 

function doPlayerTransferAllMoneyTo(cid, target)

    return doPlayerTransferMoneyTo(cid, target, getPlayerBalance(cid))

end

 

function isNumeric(str)

    return tonumber(str) ~= nil

end

 

function doPlayerBuyItem(cid, itemid, count, cost, charges)

    return doPlayerRemoveMoney(cid, cost) and doPlayerGiveItem(cid, itemid, count, charges)

end

 

function doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)

    return doPlayerRemoveMoney(cid, cost) and doPlayerGiveItemContainer(cid, containerid, itemid, count, charges)

end

 

function isPlayerUsingOtclient(cid)

    return getPlayerOperatingSystem(cid) >= CLIENTOS_OTCLIENT_LINUX

end

 

function getPlayerPassword(cid)

local AccInfo = db.getResult("SELECT `password` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")

    local AccPass = AccInfo:getDataString("password")

    return AccPass

end

 

function doPlayerAddPremiumPoints(cid, points)

    return db.Query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")

end

 

function doRemoveHouse(cid)

    local pid = getPlayerGUID(cid)

        cleanHouse(getHouseByPlayerGUID(pid))

        setHouseOwner(getHouseByPlayerGUID(pid), NO_OWNER_PHRASE,true)

    return true

end

 

function warnPlayer(cid, msg)

    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)

    return doPlayerSendCancel(cid, msg)

end

 

function createCombat(typea, effect, distEffect, area, mins, maxs)

    local combat = createCombatObject()

        setCombatParam(combat, COMBAT_PARAM_TYPE, typea)

        setCombatParam(combat, COMBAT_PARAM_EFFECT, effect)

        if(distEffect)then

            setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, distEffect)

        end

        if(type(mins) == "string" and type(maxs) == "string")then

            function getSpellDamage(cid, skill, att, attackStrength)

                local lvl, mlvl, minss, maxss = getPlayerLevel(cid), getPlayerMagLevel(cid), "", ""

                minss = "return " .. mins

                minss = minss:gsub("lvl", lvl)

                minss = minss:gsub("mlv", mlvl)

                maxss = "return " .. maxs

                maxss = maxss:gsub("lvl", lvl)

                maxss = maxss:gsub("mlv", mlvl)

                local min = -math.ceil(loadstring(minss)())

                local max = -math.ceil(loadstring(maxss)())

 

                return min, max

            end

        setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")

    end

 

        if(type(area) == "table")then

            local areaa = createCombatArea(area)

            setCombatArea(combat, areaa)

        end

    return combat

end

 

 

 

 

Link para o comentário
Compartilhar em outros sites

  • 0

Ainda não deu amigo, substitui e ainda da o mesmo erro. Tem mais alguma opinião ai do que pode ser?

Isso é o que acontece quando tento adicionar outro item na lista:

[Error - TalkAction Interface]local cid = 268446042local words = "!autoloot"local param = "add, dragon scale mail"local channel = 65534domodlib('Loot_func')local t = string.explode(string.lower(param), ",")if info.OnlyPremium == true and not isPremium(cid) thendoPlayerSendCancel(cid, "you must be a premium account.") return trueelseif not t[1] thenShowItemsTabble(cid) return trueelseif tonumber(t[1]) or tonumber(t[2]) thendoPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name") return trueelseif isInArray({"add","remove"}, tostring(t[1])) thenlocal func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or falselocal item = ExistItemByName(tostring(t[2]))if not item thendoPlayerSendCancel(cid, "This item does not exist.") return trueendlocal itemlist = getItemIdByName(tostring(t[2]))if check == true and isInArray(info.BlockItemsList, itemlist) thendoPlayerSendCancel(cid, "You can not add this item in the list!") return trueelseif isInTable(cid, itemlist) == check thendoPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.") return trueendfunc(cid, itemlist)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return trueendreturn trueDescription:[string "info = {..."]:11: attempt to concatenate local 'x' (a table value)

 

Vou explicar melhor o problema:

Quando eu pego um char que nunca executou o comando, ele funciona normal, ele abre a lista sem ter adicionado nenhum item. Porem, apos eu adicionar qualquer item, ele passa a recolher o mesmo, mas buga, não consigo mais abrir a lista de items e nem remove-lo. Ai fica dando estes erros na distro.

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...