Ir para conteúdo

Featured Replies

Postado

seguinte clan, adicionei um autoloot no meu servidor, ele funciona o colect all certinho, mas a parte que eu mais quero não funciona.

 

o que eu percebi: 

 

a lista de itens não aparece, como na imagem abaixo:

 

image.thumb.png.001b1dfb2b33ded729750021dcad0814.png

 

ok, mas quando eu dou /reload creaturescripts no servidor, os itens aparecem:

 

image.thumb.png.b7231fe305bdcad7d15171a928baa248.png

 

mas em questão de segundos somem todos de novo, reparem na imagem:

 

image.thumb.png.4528273538cc214b9bade96a3286624c.png

 

percebi também que no terminal do otclient aparece o seguinte aviso:

 

image.png.654d6ff815d481e9920c94c8c2577ade.png

 

vou deixar aqui a parte no creaturescripts que contem o script, opcode.lua:

 

Spoiler

local op_crea = {
      OPCODE_SKILL_BAR = opcodes.OPCODE_SKILL_BAR,
      OPCODE_POKEMON_HEALTH = opcodes.OPCODE_POKEMON_HEALTH,
      OPCODE_BATTLE_POKEMON = opcodes.OPCODE_BATTLE_POKEMON,
      OPCODE_FIGHT_MODE = opcodes.OPCODE_FIGHT_MODE,
      OPCODE_WILD_POKEMON_STATS = opcodes.OPCODE_WILD_POKEMON_STATS,
      OPCODE_REQUEST_DUEL = opcodes.OPCODE_REQUEST_DUEL,
      OPCODE_ACCEPT_DUEL = opcodes.OPCODE_ACCEPT_DUEL,
      OPCODE_YOU_ARE_DEAD = opcodes.OPCODE_YOU_ARE_DEAD,
      OPCODE_DITTO_MEMORY = opcodes.OPCODE_DITTO_MEMORY,
}

function onExtendedOpcode(cid, opcode, buffer)
    if opcode == op_crea.OPCODE_SKILL_BAR then
        if buffer == "refresh" then
            doOTCSendPlayerSkills(cid)
        end
    elseif opcode == op_crea.OPCODE_POKEMON_HEALTH then
        if buffer == "refresh" then
            doOTCSendPokemonHealth(cid)
        end
    elseif opcode == op_crea.OPCODE_BATTLE_POKEMON then
        if buffer == "refresh" then
            if #getCreatureSummons(cid) >= 1 then
                doSendPlayerExtendedOpcode(cid, op_crea.OPCODE_BATTLE_POKEMON, tostring(getCreatureSummons(cid)[1]))
            end
        end
    elseif opcode == op_crea.OPCODE_FIGHT_MODE then
        setPlayerStorageValue(cid, storages.fightMode, tonumber(buffer))
    elseif opcode == op_crea.OPCODE_WILD_POKEMON_STATS then
        doSendPlayerExtendedOpcode(cid, op_crea.OPCODE_WILD_POKEMON_STATS, pokeStatus.getVity(tonumber(buffer)).."|"..pokeStatus.getAtk(tonumber(buffer)).."|"..pokeStatus.getSpAtk(tonumber(buffer)).."|"..pokeStatus.getDef(tonumber(buffer)).."|"..pokeStatus.getSpDef(tonumber(buffer)).."|"..pokeStatus.getSpeed(tonumber(buffer)))
    
    --//Duel
    elseif opcode == opcodes.OPCODE_REQUEST_DUEL then
           --legenda: cid = player, sid = player convidado
           local cut = string.explode(buffer, "/")
           local pokeballsCount, sid = tonumber(cut[1]), getCreatureByName(cut[2])
                if isCreature(sid) then 
                   doIniteDuel(cid, sid, pokeballsCount)
                end
    elseif opcode == opcodes.OPCODE_ACCEPT_DUEL then
        local p2 = getCreatureByName(buffer)
           if isInvitedDuel(p2, cid) then
               doPantinNoDuel(cid, p2, getPlayerStorageValue(p2, duelTable.infoBalls), 5)
           end
           
	elseif opcode == opcodes.OPCODE_DITTO_MEMORY then
		 local item = getPlayerSlotItem(cid, 8)
			if item.uid == 0 then doSendMsg(cid, "Put your shiny ditto in correct place.") return true end
		 local pokeName = getItemAttribute(item.uid, "poke")
			if pokeName ~= "Shiny Ditto" then return true end
			
			if isInArray({"saveMemory1", "saveMemory2", "saveMemory3"}, buffer) then
			   local copyName = getItemAttribute(item.uid, "copyName")
			   if pokeName == copyName then doSendMsg(cid, "Transform your Ditto.") return true end
			   if isPokeInSlots(getItemAttribute(item.uid, "memoryDitto"), doCorrectString(copyName)) then doSendMsg(cid, "This copy is already saved in a slot.") return true end
				   if buffer == "saveMemory1" then
					   doItemSetAttribute(item.uid, "memoryDitto", saveSlot(getItemAttribute(item.uid, "memoryDitto"), 1, getItemInfo(fotos[doCorrectString(copyName)]).clientId)) -- getPortraitClientID(doCorrectString(copyName))))
				   elseif buffer == "saveMemory2" then
					   doItemSetAttribute(item.uid, "memoryDitto", saveSlot(getItemAttribute(item.uid, "memoryDitto"), 2, getItemInfo(fotos[doCorrectString(copyName)]).clientId))
				   elseif buffer == "saveMemory3" then
					   doItemSetAttribute(item.uid, "memoryDitto", saveSlot(getItemAttribute(item.uid, "memoryDitto"), 3, getItemInfo(fotos[doCorrectString(copyName)]).clientId))
				   end
			elseif isInArray({"clearSlot1", "clearSlot2", "clearSlot3"}, buffer) then
				  if buffer == "clearSlot1" then
					   doItemSetAttribute(item.uid, "memoryDitto", saveSlot(getItemAttribute(item.uid, "memoryDitto"), 1, "?"))
				   elseif buffer == "clearSlot2" then
					   doItemSetAttribute(item.uid, "memoryDitto", saveSlot(getItemAttribute(item.uid, "memoryDitto"), 2, "?"))
				   elseif buffer == "clearSlot3" then
					   doItemSetAttribute(item.uid, "memoryDitto", saveSlot(getItemAttribute(item.uid, "memoryDitto"), 3, "?"))
				   end
			elseif isInArray({"use1", "use2", "use3"}, buffer) then
				  local summons = getCreatureSummons(cid)
				  if #summons < 1 then doSendMsg(cid, "Call your ditto.") return true end
				  local pokeToTransform = getSlot(getItemAttribute(item.uid, "memoryDitto"), tonumber(buffer:explode("use")[1]))
				  doCopyPokemon(summons[1], pokeToTransform, true)
			end
			   
			   
			local memory = getItemAttribute(item.uid, "memoryDitto")
				  if not memory or memory == nil then
					 doItemSetAttribute(item.uid, "memoryDitto", "?|?|?")
					 memory = getItemAttribute(item.uid, "memoryDitto")
				  end
			local memoryOne, memoryTwo, memoryTree = memory:explode("|")[1], memory:explode("|")[2], memory:explode("|")[3]
			
			local str = memoryOne .. "-".. memoryTwo .."-" .. memoryTree
				  doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_DITTO_MEMORY, str)
                  
                  
    elseif opcode == opcodes.OPCODE_TV_CAM then -- TVCam
            --doCreatePrivateChannel(cid)
            --doInviteToPrivateChannel(cid, playerName)
            --doRemoveIntoPrivateChannel(cid, playerName)
            if getGlobalStorageValue(globalsTV) == -1 then -- iniciar sistema
                setGlobalStorageValue(globalsTV, "")
            end
            local action = buffer:explode("/")[1]
            
            if action == "create" then
                createChannel(cid, buffer)
                
            elseif action == "close" then
                closeInClientChannmel(cid)
                
            elseif action == "watch" then
            
                local playerToWatch = getCreatureByName(buffer:explode("/")[2])
                   if isCreature(playerToWatch) then
                      if getPlayerStorageValue(playerToWatch, storages.playerTVPass) ~= "" and getPlayerStorageValue(playerToWatch, storages.playerTVPass) ~= "notASSenha" then
                         doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_TV_CAM, "requestPass|" .. getPlayerStorageValue(playerToWatch, storages.playerTVPass) .. "|" .. buffer:explode("/")[2]) 
                      else
                         doWatch(cid, playerToWatch)
                      end
                    else
                     doSendMsg(cid, "This player is not recording anymore.")
                   end
                   
            elseif action == "watchWithPass" then
            
                local playerToWatch = getCreatureByName(buffer:explode("/")[2])
                   if isCreature(playerToWatch) then
                      doWatch(cid, playerToWatch)
                   else
                     doSendMsg(cid, "This player is not recording anymore.")
                   end
                   
            elseif action == "errou" then
                     doSendMsg(cid, "Wrong password.")
            end
            
	elseif opcode == opcodes.OPCODE_PLAYER_SHOW_AUTOLOOT then -- Autoloot
			if buffer:find("load/") then
			  local itens = getAllItensAutoLoot()	
			  doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_PLAYER_SHOW_AUTOLOOT, (isCollectAll(cid) and "yes" or "no") .. "|" .. itens .. "|" .. getAllItensInMyListToClient(cid))
			elseif buffer:find("all") then
			    doCollectAll(cid, true)
				doSendMsg(cid, "AutoLoot: Coletar tudo foi ativado.")
			elseif buffer:find("no") then
			    doCollectAll(cid, false)
				doSendMsg(cid, "AutoLoot: Coletar tudo foi desativado.")
			else
			  doSaveItems(cid, buffer)
			end
			
    elseif opcode == opcodes.OPCODE_PLAYER_SHOW_TRADE_HELD then
        local op = tonumber(buffer:explode("-")[2])
        local posP = getThingPos(cid)
        local posMachine = {{x = 221, y = 432, z = 7}, {x = 201, y = 651, z = 7}, {x = 200, y = 651, z = 7}, {x = 202, y = 651, z = 7}, {x = 220, y = 432, z = 7}, {x = 222, y = 432, z = 7}}
        if not doComparePositions(posMachine[1], posP) and not doComparePositions(posMachine[2], posP) and not doComparePositions(posMachine[3], posP) and not doComparePositions(posMachine[4], posP) and not doComparePositions(posMachine[5], posP) and not doComparePositions(posMachine[6], posP) then
           doSendMsg(cid, "You need to be in front of machine.")
           return true
        end
        if op == 1 then
           if doPlayerRemoveItem(cid, 15645, 15) then
              local tier = math.random(1, 2)
              doPlayerAddRandomHeld(cid, tier)
               else
              doSendMsg(cid, "You need 15 Devoted Tokens.")
           end
           return true 
        elseif op == 2 then
           if doPlayerRemoveItem(cid, 15644, 50) then
              local tier = math.random(2, 3)
              doPlayerAddRandomHeld(cid, tier)
               else
              doSendMsg(cid, "You need 50 Mighty Tokens.")
           end
           return true
        elseif op == 3 then
           if doPlayerRemoveItem(cid, 15644, 80) then
              local tier = math.random(2, 4)
              doPlayerAddRandomHeld(cid, tier)
               else
              doSendMsg(cid, "You need 80 Mighty Tokens.")
           end
           return true
        elseif op == 4 then
           if doPlayerRemoveItem(cid, 15644, 150) then
              local tier = math.random(4, 6)
              doPlayerAddRandomHeld(cid, tier)
               else
              doSendMsg(cid, "You need 150 Mighty Tokens.")
           end
           return true 
        elseif op == 5 then
           if doPlayerRemoveItem(cid, 15646, 10) then
              local tier = math.random(3, 3)
              doPlayerAddRandomHeld(cid, tier)
               else
              doSendMsg(cid, "You need 10 Honored Tokens.")
           end
           return true 
        elseif op == 6 then
           if doPlayerRemoveItem(cid, 15646, 50) then
              local tier = math.random(3, 5)
              doPlayerAddRandomHeld(cid, tier)
               else
              doSendMsg(cid, "You need 50 Honored Tokens.")
           end
           return true
        elseif op == 7 then
           if doPlayerRemoveItem(cid, 15646, 300) then
              local tier = math.random(5, 7)
              doPlayerAddRandomHeld(cid, tier)
               else
              doSendMsg(cid, "You need 300 Honored Tokens.")
			  end
        end
    end
end
function getSlot(strings, slot)
    local slot1, slot2, slot3 = strings:explode("|")[1], strings:explode("|")[2], strings:explode("|")[3]
    local ret, flag = "", false
    for a, b in pairs(fotos) do
       if getItemInfo(fotos[a]).clientId == tonumber(slot1) and slot == 1 then 
          ret = doCorrectString(a)
          flag = true
       elseif getItemInfo(fotos[a]).clientId == tonumber(slot2) and slot == 2  then 
          ret = doCorrectString(a)
          flag = true
       elseif getItemInfo(fotos[a]).clientId == tonumber(slot3) and slot == 3 then 
          ret = doCorrectString(a)
          flag = true
       end
           if flag then
              break
           end    
    end
    return ret
end
function saveSlot(strings, slot, poke)
    local slot1, slot2, slot3 = strings:explode("|")[1], strings:explode("|")[2], strings:explode("|")[3]
    local finalSlots = (slot == 1 and poke .. "|" or slot1 .. "|") .. (slot == 2 and poke .. "|" or slot2 .. "|") .. (slot == 3 and poke .. "|" or slot3)
        return finalSlots
end
function isPokeInSlots(strings, poke)
    if not fotos[poke] then return false end
    poke = getItemInfo(fotos[poke]).clientId
    local slot1, slot2, slot3 = strings:explode("|")[1], strings:explode("|")[2], strings:explode("|")[3]
    if tonumber(slot1) == poke then
       return true
    elseif tonumber(slot2) == poke then
       return true
    elseif tonumber(slot3) == poke then
       return true
    end
    return false
end
 

 

 

117 - autoloot.lua :

 

Spoiler

itensAutoLoot = {
["future orb"] = {12194, raridade = {40, 80, "Facil"} , 200},
["enchanted gem"] = {13785, raridade = {40, 80, "Facil"} , 300},
["small stone"] = {12337, raridade = {40, 80, "Facil"} , 50},
["stone orb"] = {12196, raridade = {40, 80, "Facil"} , 50},
["rock stone"] = {11445, raridade = {15, 35, "Medio"} , 10000},
["Old amber"] = {12581, raridade = {0.1, 1.0, "Extremamente Raro"} , 2000000},
["Bag Box"] = {12338, raridade = {2, 10, "Raro"} , 20000},
["twisted spoon"] = {12193, raridade = {40, 80, "Facil"} , 200},
["enigma stone"] = {11452, raridade = {15, 35, "Medio"} , 10000},
["bottles of poison"] = {12165, raridade = {40, 80, "Facil"} , 200},
["venom pendant"] = {12282, raridade = {40, 80, "Facil"} , 200},
["snake tail"] = {13863, raridade = {15, 35, "Medio"} , 200},
["venom stone"] = {11443, raridade = {15, 35, "Medio"} , 200},
["fire stone"] = {11447, raridade = {15, 35, "Medio"} , 200},
["magma box"] = {12271, raridade = {15, 35, "Medio"} , 200},
["pot with fire"] = {12342, raridade = {40, 80, "Facil"} , 200},
["pot of lava"] = {12152, raridade = {40, 80, "Facil"} , 200},
["nail"] = {12157, raridade = {40, 80, "Facil"} , 200},
["essence of fire"] = {12162, raridade = {40, 80, "Facil"} , 200},
["pot of moss bug"] = {12171, raridade = {40, 80, "Facil"} , 200},
["bug gosme"] = {13783, raridade = {40, 80, "Facil"} , 200},
["cocoon stone"] = {11448, raridade = {15, 35, "Medio"} , 200},
["seed"] = {12163, raridade = {40, 80, "Facil"} , 200},
["pair of leaves"] = {12155, raridade = {40, 80, "Facil"} , 200},
["bag of pollem"] = {12153, raridade = {40, 80, "Facil"} , 200},
["water gem"] = {12161, raridade = {40, 80, "Facil"} , 200},
["water pendant"] = {12170, raridade = {40, 80, "Facil"} , 200},
["Water Stone"] = {11442, raridade = {15, 35, "Medio"} , 200},
["bulbs"] = {12154, raridade = {40, 80, "Facil"} , 200},
["bug antenna"] = {12184, raridade = {40, 80, "Facil"} , 200},
["comb"] = {12179, raridade = {40, 80, "Facil"} , 200},
["heart stone"] = {11453, raridade = {15, 35, "Medio"} , 200},
["big egg"] = {12211, raridade = {40, 80, "Facil"} , 200},
["zard wing"] = {12270, raridade = {40, 80, "Facil"} , 200},
["dragon tooth"] = {12159, raridade = {40, 80, "Facil"} , 200},
["fire tail"] = {13892, raridade = {40, 80, "Facil"} , 200},
["topknot"] = {13901, raridade = {15, 35, "Medio"} , 200},
["ice orb"] = {12201, raridade = {40, 80, "Facil"} , 200},
["locksmith of shell"] = {12203, raridade = {40, 80, "Facil"} , 200},
["Snowball"] = {13794, raridade = {40, 80, "Facil"} , 200},
["Horn"] = {13789, raridade = {40, 80, "Facil"} , 200},
["ice stone"] = {11454, raridade = {15, 35, "Medio"} , 200},
["strange spikes"] = {13900, raridade = {40, 80, "Facil"} , 200},
["sandbag"] = {12177, raridade = {40, 80, "Facil"} , 200},
["bone"] = {12208, raridade = {40, 80, "Facil"} , 200},
["majesty wing"] = {12268, raridade = {40, 80, "Facil"} , 200},
["sea tail"] = {13898, raridade = {40, 80, "Facil"} , 200},
["feather"] = {12200, raridade = {40, 80, "Facil"} , 200},
["bird break"] = {12172, raridade = {40, 80, "Facil"} , 200},
["crystal stone"] = {11449, raridade = {15, 35, "Medio"} , 200},
["dragon tail"] = {12276, raridade = {40, 80, "Facil"} , 200},
["big wing"] = {12275, raridade = {40, 80, "Facil"} , 200},
["earth stone"] = {11451, raridade = {15, 35, "Medio"} , 200},
["screw"] = {12164, raridade = {40, 80, "Facil"} , 200},
["electric box"] = {12176, raridade = {40, 80, "Facil"} , 200},
["thunder stone"] = {11444, raridade = {15, 35, "Medio"} , 200},
["buzz tail"] = {12169, raridade = {40, 80, "Facil"} , 200},
["ancient stone"] = {12244, raridade = {2, 10, "Raro"} , 200},
["leaf stone"] = {11441, raridade = {15, 35, "Medio"} , 200},
["stick slash"] = {12199, raridade = {40, 80, "Facil"} , 200},
["traces of ghost"] = {12204, raridade = {40, 80, "Facil"} , 200},
["darkness gem"] = {12745, raridade = {40, 80, "Facil"} , 200},
["essence of dark"] = {12206, raridade = {40, 80, "Facil"} , 200},
["darkness stone"] = {11450, raridade = {15, 35, "Medio"} , 200},
["bat wing"] = {12182, raridade = {40, 80, "Facil"} , 200},
["tooth"] = {12175, raridade = {40, 80, "Facil"} , 200},
["strange rock"] = {13867, raridade = {40, 80, "Facil"} , 200},
["gosme"] = {12202, raridade = {40, 80, "Facil"} , 200},
["gyarados tail"] = {12148, raridade = {40, 80, "Facil"} , 200},
["punch stone"] = {11446, raridade = {15, 35, "Medio"} , 200},
["seahorse tail"] = {13864, raridade = {40, 80, "Facil"} , 200},
["ice bra"] = {12168, raridade = {40, 80, "Facil"} , 200},
["dome fossil"] = {12579, raridade = {2, 10, "Raro"} , 200},
["kangskhan war"] = {13888, raridade = {40, 80, "Facil"} , 200},
["pair of claws"] = {12269, raridade = {40, 80, "Facil"} , 200},
["venom flute"] = {12210, raridade = {40, 80, "Facil"} , 200},
["crab claws"] = {12207, raridade = {40, 80, "Facil"} , 200},
["dome fossil"] = {12579, raridade = {2, 10, "Raro"} , 200},
}

local storageUsing = storages.UsingAutoLoot
function doSaveItems(cid, items)
	setPlayerStorageValue(cid, storages.AutoLootList, items)
end

function doCollectAll(cid, col)
	setPlayerStorageValue(cid, storages.AutoLootCollectAll, col == true and "all" or "no")
end

function isCollectAll(cid)
   return getPlayerStorageValue(cid, storages.AutoLootCollectAll):find("all") and true or false
end
function getAllItensInMyList(cid)
	local myList = getPlayerStorageValue(cid, storages.AutoLootList)
	if myList == -1 or myList == "save/" or myList == "load/" or type(myList) ~= "string" then return {} end
	return myList:explode("/")[2]:explode(",")
end

function getAllItensInMyListToClient(cid)
	local myList = getAllItensInMyList(cid)
	local str = "autoloot/"
	for i = 1, #myList do
	    info = getItemInfo(getItemIdByName(myList[i]))
		if info then
			if itensAutoLoot[myList[i]] then
			   rate = itensAutoLoot[myList[i]].raridade[3]
			else
			   rate = "???"
			end
			str = str .. info.clientId .. "," .. info.name .. "," .. rate .. (i == #myList and "" or "/")
		end
	end
	return str == "autoloot/" and "" or str
end

function getAllItensAutoLoot()
local str = "autoloot/" 
	  for a, b in pairs(itensAutoLoot) do
	    info = getItemInfo(b[1])
		rate = b.raridade[3]
		str = str .. info.clientId .. "," .. info.name .. "," .. rate .. (i == #itensAutoLoot and "" or "/")
      end
	  return str
end

 

 

to precisando bastante disso, se alguém entender disso, por favor, me ajuda :( valeu clan

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.8k

Informação Importante

Confirmação de Termo