Ir para conteúdo

Oneshot

Marquês
  • Total de itens

    1347
  • Registro em

  • Última visita

  • Dias Ganhos

    36

Tudo que Oneshot postou

  1. Oneshot

    {Resolvido}

    local config = { [2153] = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_STAT_MAXHEALTH] = 150, [CONDITION_PARAM_SUBID] = 10 } }, [2154] = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_STAT_MAXMANA] = 150, [CONDITION_PARAM_SUBID] = 20 } }, [2155] = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_SKILL_MELEE] = 3, [CONDITION_PARAM_SKILL_DISTANCE] = 3, [CONDITION_PARAM_SUBID] = 30 } }, [2156] = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_STAT_MAGICLEVEL] = 2, [CONDITION_PARAM_SUBID] = 40 } } } local tmp = {} for itemid, conditions in pairs(config) do tmp[itemid] = {} for i = 1, 3 do for condition, parameters in pairs(conditions) do local obj = createConditionObject(condition) setConditionParam(obj, CONDITION_PARAM_TICKS, -1) for parameter, value in pairs(parameters) do setConditionParam(obj, parameter, value) end setConditionParam(obj, CONDITION_PARAM_SUBID, config[itemid][condition][CONDITION_PARAM_SUBID] + i) setConditionParam(obj, CONDITION_PARAM_BUFF, true) tmp[itemid][i] = obj end end end local storage = 30001 function onUse(cid, item, fromPosition, itemEx, toPosition) local status = getCreatureStorage(cid, storage) if status < 0 then doCreatureSetStorage(cid, storage, 0) end if item.itemid == 2158 then doRemoveConditions(cid, false) doCreatureSetStorage(cid, storage, 0) doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE) return true end if not tmp[item.itemid] then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) return true end if status == 3 then doPlayerSendCancel(cid, "You cannot use support runes anymore.") return true end doAddCondition(cid, tmp[item.itemid][status + 1]) doCreatureSetStorage(cid, storage, status + 1) doRemoveItem(item.uid, 1) return true end
  2. LuckOake, para que um for com pairs percorrendo toda uma tabela, se você pode simplesmente acessar diretamente o index que você quer? Veja abaixo: local efeitos = { [62] = 75, [63] = 75, [72] = 75, [73] = 75, [74] = 75, [75] = 75, [76] = 75, [77] = 75, [79] = 75, [80] = 75, [78] = 13, [81] = 13 } function castEffect(cid, effect) if isCreature(cid) then doSendMagicEffect(getThingPosition(cid), effect) addEvent(castEffect, 1 * 1000, cid, effect) end end function onLogin(cid) if not efeitos[getPlayerVocation(cid)] then return true end castEffect(cid, efeitos[getPlayerVocation(cid)]) return true end
  3. Oneshot

    Fire Aura

    Nome: Fire Aura Autor: Oneshot Tipo: Magia Faz tempo que eu não faço magias, então eu resolvi escrever qualquer coisa e deu nisso, uma aura que fica circundando o jogador por X tempo causando dano. Crie um arquivo chamado fire aura.lua, e coloque o conteúdo abaixo: local offsets = { [0] = {{0, 0}, {1, 0}, {1, 1}, {1, 2}, {0, 2}, {-1, 2}, {-1, 1}, {-1, 0}}, [1] = {{0, 0}, {0, 1}, {-1, 1}, {-2, 1}, {-2, 0}, {-2, -1}, {-1, -1}, {0, -1}}, [2] = {{0, 0}, {-1, 0}, {-1, -1}, {-1, -2}, {0, -2}, {1, -2}, {1, -1}, {1, 0}}, [3] = {{0, 0}, {0, -1}, {1, -1}, {2, -1}, {2, 0}, {2, 1}, {1, 1}, {0, 1}} } local storage = 88888 local k = 1 local duration = 30 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 10, 10, 2.4, 2.4) function onCastAura(cid, lastDirection) local position = getPositionByDirection(getThingPosition(cid), lastDirection, 1) local offset = offsets[lastDirection][(k > #offsets[lastDirection] and ((k % #offsets[lastDirection]) == 0 and #offsets[lastDirection] or (k % #offsets[lastDirection])) or k)] local tmp = {x = position.x + offset[1], y = position.y + offset[2], z = position.z} doCombat(cid, combat, positionToVariant(tmp)) doCreatureSetLookDirection(cid, lastDirection) if os.time() < getCreatureStorage(cid, storage) then addEvent(onCastAura, 100, cid, getCreatureLookDirection(cid)) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Aura effect ended.") mayNotMove(cid, false) end k = k + 1 end function onCastSpell(cid, var) doCreatureSetStorage(cid, storage, os.time() + duration) mayNotMove(cid, true) onCastAura(cid, getCreatureLookDirection(cid)) return true end No spells.xml, adicione uma linha: <instant name="Fire Aura" words="fire aura" lvl="100" mana="550" needlearn="0" event="script" value="fire aura.lua"/> A magia tem uma duração de 30 segundos, porém essa duração é configurável. Como ainda não criei uma lógica relacionando o movimento do jogador com a aura, então resolvi travar o movimento do jogador enquanto a magia é executada. Abaixo a demonstração em GIF dela. O script está bem pogado, talvez eu consiga entender melhor o padrão e melhorar a construção do código. Mude aqui efeito e tipo de dano se quiser, para criar outras auras: local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 10, 10, 2.4, 2.4) Abraços.
  4. local i = { ["12:00"] = {nome = "Vip Coin Meio Dia", pos = {x=10159, y=10059, z=7}, monster = {"1 vip coin", "50 Fire Devil", "4 lord vampire"}}, ["00:00"] = {nome = "vip coin da meia noite", pos = {x=10159, y=1059, z=7}, monster = {"1 vip coin"}}, ["06:00"] = {nome = "Vip Coin da manha", pos = {x=10159, y=10059, z=7}, monster = {"1 vip coin", "50 Fire Devil", "4 lord vampire"}}, } function onThink(interval, lastExecution) hours = tostring(os.date("%X")):sub(1, 5) tb = i[hours] if tb then doBroadcastMessage(hours .. " - " .. tb.nome .. " Iníciou.") doBroadcastMessage(hours .. " - " .. tb.nome .. " está rolando venham templo!") for _,x in pairs(tb.monster) do for s = 1, tonumber(x:match("%d+")) do doSummonCreature(x:match("%s(.+)"), tb.pos) end end doBroadcastMessage("No-PVP ativado para o evento.") setWorldType(1) addEvent(setWorldType, 2 * 60 * 1000, 2) end return true end
  5. Bela iniciativa. Acho que o nome do tutorial devia ser "Função - O que é ela e como usar?", pois o que você chama de libs é só um artificio de salvar suas funções em um arquivo .lua dentro da pasta data/lib para tornar o uso dessa, global. Você poderia também detalhar mais a construção de uma função, como, por exemplo, dizer: function doPlayerSendMsg(cid, msg) É um açúcar-de-sintaxe, syntax sugar, em outras palavras, algo que facilita a construção do código e deixa a leitura deste mais agradável aos olhos. Segundo o Manual de Referência, essa é a definição de uma função: doPlayerSendMsg = function(cid, msg) end Não curto muito o estilo corrido dos seus tutoriais, mas mesmo assim, está bem detalhado para os iniciantes no estudo da linguagem. Mas não deixe de detalhar mais o retorno de valores nas funções e a chamada delas em scripts. Abraços.
  6. Ah, não tinha ideia que seria aplicado na transformação de um chão. Pensei que seria para criar itens mesmo em uma área. Enfim, local area_frompos = {x = 100, y = 100, z = 7} local area_topos = {x = 150, y = 150, z = 7} local tiles = {406, 407} function onUse(cid, item, fromPosition, itemEx, toPosition) for x = area_frompos.x, area_topos.x do for y = area_frompos.y, area_topos.y do local position = {x = x, y = y, z = area_frompos.z} local g = getTileItemById(position, tiles[1]) if g.uid > 0 then doTransformItem(g.uid, tiles[2]) else g = getTileItemById(position, tiles[2]) if g.uid > 0 then doTransformItem(g.uid, tiles[1]) else doCreateItem(tiles[1], position) end end end end doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) return true end
  7. Como é para ser feito? Puxar a alavanca e deletar os itens, puxar denovo e criar?
  8. http://www.xtibia.co...lde-blacksmith/
  9. Nome: Ye Olde Blacksmith Tipo: NPC Autor: Oneshot Este é um simples NPC pedido por muitos, ele troca certos itens por outros itens, similar ao sistema de forja que desenvolvi. Crie um arquivo chamado blacksmith.lua em data/npc/scripts, com o nome que você desejar. Coloque o conteúdo abaixo: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local forge = {} local recipes = { [2390] = { {2157, 1}, {2400, 1}, {2149, 100} } } function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function onGreetCallback(cid) talkState[cid] = 0 forge[cid] = {match = nil, recipe = nil} return true end function onCreatureSayCallback(cid, class, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if talkState[talkUser] == 0 then for itemid, items in pairs(recipes) do if msgcontains(msg, getItemNameById(itemid)) then forge[talkUser] = {match = itemid, recipe = items} break end end if forge[talkUser].match ~= nil then local str, sep = "Good choice, I will need" local n = 1 for _, item in ipairs(forge[talkUser].recipe) do sep = (n == 1) and " " or (n == #forge[talkUser].recipe and " and " or ", ") str = str .. sep .. (item[2] or 1) .." ".. getItemNameById(item[1]) n = n + 1 end str = str ..". Agreed?" npcHandler:say(str, cid) talkState[talkUser] = 1 else npcHandler:say("Sorry, I don't know how to forge it.", cid) end elseif talkState[talkUser] == 1 then if msgcontains(msg, "yes") then local ret = {} for _, item in ipairs(forge[talkUser].recipe) do local g = getPlayerItemById(cid, true, item[1]) if g.uid > 0 and math.max(1, g.type) >= item[2] then table.insert(ret, {g.uid, item[2]}) else ret = {} break end end if #ret > 0 then for _, item in ipairs(ret) do doRemoveItem(item[1], item[2]) end doPlayerAddItemEx(cid, doCreateItemEx(forge[talkUser].match, 1)) npcHandler:say("Thank you, heh, here is your ".. getItemNameById(forge[talkUser].match) ..".", cid) else npcHandler:say("Sorry, but you don't have all the items I need.", cid) talkState[talkUser] = 0 forge[talkUser] = {match = nil, recipe = nil} end elseif msgcontains(msg, "no") then npcHandler:say("Alright, do you need anything else?.", cid) talkState[talkUser] = 0 forge[talkUser] = {match = nil, recipe = nil} end end return true end local greet, sep = "Hello, |PLAYERNAME|. Actually I can trade {rare} stuff for some items, pretty, heh? This is what I have:" local n = 1 for item, recipe in pairs(recipes) do sep = (n == 1) and " " or (n == #recipes and " and " or ", ") greet = greet .. sep .. "{".. getItemNameById(item) .."}" n = n + 1 end npcHandler:setMessage(MESSAGE_GREET, greet) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback) npcHandler:setCallback(CALLBACK_GREET, onGreetCallback) npcHandler:addModule(FocusModule:new()) Crie um arquivo XML para o NPC em data/npc/ <?xml version="1.0" encoding="UTF-8"?> <npc name="Ye Olde Blacksmith" script="nome_do_arquivo.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="128" head="17" body="54" legs="114" feet="0" addons="2"/> </npc> Você pode mudar o visual do NPC alterando os números dessa linha: <look type="128" head="17" body="54" legs="114" feet="0" addons="2"/> Para configurar os itens que o NPC pode fazer e os itens que são necessários, altere a tabela abaixo: local recipes = { [2390] = { {2157, 1}, {2400, 1}, {2149, 100} } } Sempre seguindo a estrutura da tabela, colocando vírgula no final da chave "}" com exceção da última. Abraços.
  10. Oneshot

    {Resolvido}

    Adicione a linha: doRemoveItem(item.uid, 1) Antes do último: return true Abraços.
  11. Vocês acham que é só pegar e trocar o executável do servidor e pronto - sou foda - troquei a versão do servidor. 1. Para o erro no channels.xml, substitua o conteúdo antigo por este: <?xml version="1.0" encoding="UTF-8"?> <channels> <!-- README: 0 - dynamic, reserved for guilds 1 - always acts as Party channel, only "name" tag available 6 - acts as Help channel- clientsided message 65535 - DO NOT CHANGE THE ID- only "name", "enabled", "active" and "logged" tags available --> <channel id="1" name="Party"/> <channel id="2" name="Counselor" access="1"/> <channel id="3" name="World Chat" level="2"/> <channel id="4" name="Staff" access="3"/> <channel id="5" name="Advertising" level="8" muted="120" conditionId="3" conditionMessage="You may only place one offer in two minutes."> <vocation id="1-8"/> </channel> <channel id="6" name="Advertising-Rookgaard" level="2" muted="120" conditionId="4" conditionMessage="You may only place one offer in two minutes."> <vocation id="0"/> </channel> <channel id="7" name="Help" logged="yes" muted="30" conditionId="5" conditionMessage="You may only send a message in thirty seconds."/> <channel id="8" name="English Chat" level="2"/> <!-- <channel id="9" name="My Custom Channel"/> --> <channel id="65535" name="Private Chat Channel"/> </channels> 2. Acho que dá para interpretar os erros acusados no creaturescripts.xml, a versão que você está usando já não possui mais os creaturescripts joinchannel e receivemail, ou melhor, possui, porém o parâmetro que chama a função mudou. Abra seu creaturescripts.xml. Troque: <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/> Por: <event type="channeljoin" name="GuildMotd" event="script" value="guildmotd.lua"/> Troque: <event type="receivemail" name="Mail" event="script" value="mail.lua"/> Por: <event type="mailreceive" name="Mail" event="script" value="mail.lua"/> 3. O terceiro erro é um sistema implementado nas revisões mais atuais do The Forgotten Server, principalmente aquelas voltadas as versões mais atuais do Tibia. O sistema é simples, ele armazena todas as mensagens ditas no servidor, todas mesmo, em uma tabela chamada player_statements. O problema é que o Elf e a equipe da OTLand, não previu que, nós, brasileiros, tivéssemos um emoticon tão tosco igual esse - '-' - que dá o erro na hora de armazenar na tabela. Infelizmente não há como desativar esse sistema de maneira direta, apenas indiretamente editando as sources da revisão que você usa. 4. Por último, são erros generalizados gerados pela incompatibilidade dos mods do seu servidor com essa revisão do The Forgotten Server que você está a usar. Apenas adaptações nesses mods para que eles funcionem sem apresentar erros. Abraços.
  12. Acho que funcionará agora, declarei a variável exhaust dentro da função doFish, o que deve ter ocasionado o erro. local fishing = { ["Magikarp"] = {skill = 0, level = -2}, --["Qwilfish"] = {skill = 18, level = 3}, --["Remoraid"] = {skill = 16, level = 2}, ["Staryu"] = {skill = 22, level = 6}, ["Tentacool"] = {skill = 20, level = 7}, ["Goldeen"] = {skill = 17, level = 5}, ["Krabby"] = {skill = 14, level = 2}, ["Horsea"] = {skill = 16, level = 3}, ["Poliwag"] = {skill = 15, level = 2}, --["Marill"] = {skill = 39, level = 3}, --["Azumarill"] = {skill = 57, level = 16}, ["Kingler"] = {skill = 45, level = 14}, ["Seaking"] = {skill = 48, level = 11}, ["Starmie"] = {skill = 59, level = 20}, --["Chinchou"] = {skill = 23, level = 6}, ["Poliwhirl"] = {skill = 37, level = 9}, ["Seadra"] = {skill = 51, level = 15}, --["Lanturn"] = {skill = 58, level = 14}, --["Octillery"] = {skill = 40, level = 9}, --["Corsola"] = {skill = 56, level = 16} } local storage = 15458 local bonus = 1 local limite = 100 local function doFish(cid, pos, ppos, chance, interval, number) if not isCreature(cid) then return false end if getThingPos(cid).x ~= ppos.x or getThingPos(cid).y ~= ppos.y then return false end if getPlayerStorageValue(cid, storage) ~= number then return false end doSendMagicEffect(pos, CONST_ME_LOSEENERGY) local peixe = 0 local playerpos = getClosestFreeTile(cid, getThingPos(cid)) local level = 1 local fishes = {} local randomfish = "" if getPlayerSkillLevel(cid, 6) < limite then doPlayerAddSkillTry(cid, 6, bonus) end for a, b in pairs (fishing) do if getPlayerSkillLevel(cid, 6) >= b.skill then table.insert(fishes, a) end end if math.random(1, 100) <= chance then if getPlayerSkillLevel(cid, 6) < limite then doPlayerAddSkillTry(cid, 6, bonus) end randomfish = fishes[math.random(#fishes)] level = getPlayerSkillLevel(cid, 6) / 3 level = level + getPlayerLevel(cid) / 5 level = math.random(level * 0.6, level) level = level + fishing[randomfish].level peixe = doSummonCreature(randomfish, playerpos) if level <= 0 then level = math.random(getPlayerLevel(cid)) end if not isCreature(peixe) then addEvent(doFish, interval, cid, pos, ppos, chance, interval, number) return true end doSetMonsterPassive(peixe) doWildAttackPlayer(peixe, cid) if #getCreatureSummons(cid) >= 1 then doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 173) doChallengeCreature(getCreatureSummons(cid)[1], peixe) else doSendMagicEffect(getThingPos(cid), 173) doChallengeCreature(cid, peixe) end return true end addEvent(doFish, interval, cid, pos, ppos, chance, interval, number) return true end local waters = {4614, 4615, 4616, 4617, 4618, 4619, 4608, 4609, 4610, 4611, 4612, 4613, 7236, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825} local stor_ = 98725 local exhaust = 5 -- em segundos function onUse(cid, item, fromPos, itemEx, toPos) if getPlayerGroupId(cid) == 11 then return true end local checkPos = toPos checkPos.stackpos = 0 if getTileThingByPos(checkPos).itemid <= 0 then doPlayerSendCancel(cid, '!') return true end if not isInArray(waters, getTileInfo(toPos).itemid) then return true end if (getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 63215) >= 1) and not canFishWhileSurfingOrFlying then doPlayerSendCancel(cid, "You can't fish while surfing/flying.") return true end if getCreatureStorage(cid, stor_) > os.time() then return doPlayerSendCancel(cid, "Aguarde ".. getCreatureStorage(cid, storage) - os.time() .." segundos.") end if isInArray(waters, getTileInfo(getThingPos(cid)).itemid) then doPlayerSendCancel(cid, "You can\'t fish while surfing neither flying above water.") return true end if getTileInfo(getThingPos(getCreatureSummons(cid)[1] or cid)).protection then doPlayerSendCancel(cid, "You can't fish pokémons if you or your pokémon is in protection zone.") return true end if not tonumber(getPlayerStorageValue(cid, storage)) then local test = io.open("data/sendtobrun123.txt", "a+") local read = "" if test then read = test:read("*all") test:close() end read = read.."\n[fishing.lua] "..getCreatureName(cid).." - "..getPlayerStorageValue(cid, storage).."" local reopen = io.open("data/sendtobrun123.txt", "w") reopen:write(read) reopen:close() setPlayerStorageValue(cid, storage, 1) end setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1) if getPlayerStorageValue(cid, storage) >= 800 then setPlayerStorageValue(cid, storage, 1) end setPlayerStorageValue(cid, stor_, os.time() + exhaust) local delay = 3500 - getPlayerSkillLevel(cid, 6) * 25 local chance = 10 + getPlayerSkillLevel(cid, 6) / 2.5 doFish(cid, toPos, getThingPos(cid), chance, delay, getPlayerStorageValue(cid, storage)) return true end
  13. Então, "parceiro", apenas com edições nas sources. Abraços.
  14. Santo Lua, se você continuasse esse padrão, você teria um script com cerca de 23000 linhas. local area_frompos = {x = 100, y = 100, z = 7} local area_topos = {x = 150, y = 150, z = 7} function onUse(cid, item, fromPosition, itemEx, toPosition) for x = area_frompos.x, area_topos.x do for y = area_frompos.y, area_topos.y do local position = {x = x, y = y, z = area_frompos.z} local g = getTileItemById(position, 1284) if g.uid > 0 then doRemoveItem(g.uid) end doCreateItem(1284, 1, position) end end doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) return true end
  15. local fishing = { ["Magikarp"] = {skill = 0, level = -2}, --["Qwilfish"] = {skill = 18, level = 3}, --["Remoraid"] = {skill = 16, level = 2}, ["Staryu"] = {skill = 22, level = 6}, ["Tentacool"] = {skill = 20, level = 7}, ["Goldeen"] = {skill = 17, level = 5}, ["Krabby"] = {skill = 14, level = 2}, ["Horsea"] = {skill = 16, level = 3}, ["Poliwag"] = {skill = 15, level = 2}, --["Marill"] = {skill = 39, level = 3}, --["Azumarill"] = {skill = 57, level = 16}, ["Kingler"] = {skill = 45, level = 14}, ["Seaking"] = {skill = 48, level = 11}, ["Starmie"] = {skill = 59, level = 20}, --["Chinchou"] = {skill = 23, level = 6}, ["Poliwhirl"] = {skill = 37, level = 9}, ["Seadra"] = {skill = 51, level = 15}, --["Lanturn"] = {skill = 58, level = 14}, --["Octillery"] = {skill = 40, level = 9}, --["Corsola"] = {skill = 56, level = 16}, } local storage = 15458 local bonus = 1 local limite = 100 local function doFish(cid, pos, ppos, chance, interval, number) if not isCreature(cid) then return false end if getThingPos(cid).x ~= ppos.x or getThingPos(cid).y ~= ppos.y then return false end if getPlayerStorageValue(cid, storage) ~= number then return false end doSendMagicEffect(pos, CONST_ME_LOSEENERGY) local peixe = 0 local playerpos = getClosestFreeTile(cid, getThingPos(cid)) local level = 1 local fishes = {} local randomfish = "" local exhaust = 5 -- em segundos if getPlayerSkillLevel(cid, 6) < limite then doPlayerAddSkillTry(cid, 6, bonus) end for a, b in pairs (fishing) do if getPlayerSkillLevel(cid, 6) >= b.skill then table.insert(fishes, a) end end if math.random(1, 100) <= chance then if getPlayerSkillLevel(cid, 6) < limite then doPlayerAddSkillTry(cid, 6, bonus) end randomfish = fishes[math.random(#fishes)] level = getPlayerSkillLevel(cid, 6) / 3 level = level + getPlayerLevel(cid) / 5 level = math.random(level * 0.6, level) level = level + fishing[randomfish].level peixe = doSummonCreature(randomfish, playerpos) if level <= 0 then level = math.random(getPlayerLevel(cid)) end if not isCreature(peixe) then addEvent(doFish, interval, cid, pos, ppos, chance, interval, number) return true end doSetMonsterPassive(peixe) doWildAttackPlayer(peixe, cid) if #getCreatureSummons(cid) >= 1 then doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 173) doChallengeCreature(getCreatureSummons(cid)[1], peixe) else doSendMagicEffect(getThingPos(cid), 173) doChallengeCreature(cid, peixe) end return true end addEvent(doFish, interval, cid, pos, ppos, chance, interval, number) return true end local waters = {4614, 4615, 4616, 4617, 4618, 4619, 4608, 4609, 4610, 4611, 4612, 4613, 7236, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825} local stor_ = 98725 function onUse(cid, item, fromPos, itemEx, toPos) if getPlayerGroupId(cid) == 11 then return true end local checkPos = toPos checkPos.stackpos = 0 if getTileThingByPos(checkPos).itemid <= 0 then doPlayerSendCancel(cid, '!') return true end if not isInArray(waters, getTileInfo(toPos).itemid) then return true end if (getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 63215) >= 1) and not canFishWhileSurfingOrFlying then doPlayerSendCancel(cid, "You can't fish while surfing/flying.") return true end if getCreatureStorage(cid, stor_) > os.time() then return doPlayerSendCancel(cid, "Aguarde ".. getCreatureStorage(cid, storage) - os.time() .." segundos.") end if isInArray(waters, getTileInfo(getThingPos(cid)).itemid) then doPlayerSendCancel(cid, "You can\'t fish while surfing neither flying above water.") return true end if getTileInfo(getThingPos(getCreatureSummons(cid)[1] or cid)).protection then doPlayerSendCancel(cid, "You can't fish pokémons if you or your pokémon is in protection zone.") return true end if not tonumber(getPlayerStorageValue(cid, storage)) then local test = io.open("data/sendtobrun123.txt", "a+") local read = "" if test then read = test:read("*all") test:close() end read = read.."\n[fishing.lua] "..getCreatureName(cid).." - "..getPlayerStorageValue(cid, storage).."" local reopen = io.open("data/sendtobrun123.txt", "w") reopen:write(read) reopen:close() setPlayerStorageValue(cid, storage, 1) end setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1) if getPlayerStorageValue(cid, storage) >= 800 then setPlayerStorageValue(cid, storage, 1) end setPlayerStorageValue(cid, stor_, os.time() + exhaust) local delay = 3500 - getPlayerSkillLevel(cid, 6) * 25 local chance = 10 + getPlayerSkillLevel(cid, 6) / 2.5 doFish(cid, toPos, getThingPos(cid), chance, delay, getPlayerStorageValue(cid, storage)) return true end local exhaust = 5 -- em segundos Coloquei um padrão de cinco segundos de exhaust.
  16. Linha 74: Tentativa de comparar nulo com número local thishp = getItemAttribute(item.uid, "hp") if thishp <= 0 then No caso, a variável thishp está sendo comparada com 0, o problema é que essa variável está retornando nulo - a razão é simples - o item (no caso a pokeball) não possui um atributo chamado hp Linha 5: Tentativa de "juntar" um valor nulo local name = getItemAttribute(item.uid, "poke") .. getItemAttribute(item.uid, "ballorder") Um desses atributos de item.uid está retornando nulo, fazendo com que juntar os dois em uma única string faça o erro acontecer. Junto com o for usado no script, o erro é multiplicado em um loop. Nunca trabalhei com servidores de Pokémon, então não tenho ideia de como solucionar estes erros, mas uma coisa posso te dizer, você fez algo errado em algum momento que manipulou arquivos do servidor. Abraços.
  17. <talkaction words="/banip" access="5" event="script" value="nome_do_arquivo.lua"/> Desculpe, só usar a linha acima.
  18. Ou dá para fazer com co-rotinas, o que é meio inviável, mas bem prático local sto = 100000 function onUse(cid, item, fromPosition, itemEx, toPosition) local thread = coroutine.create(function(cid, storage) print(getCreatureStorage(cid, storage)) end) local get_sto = getCreatureStorage(cid, storage) print(get_sto) doCreatureSetStorage(cid, storage, get_sto + 1) coroutine.resume(thread, cid, storage) return true end Não havia pensado no método desenvolvido pelo Slicer e é funcional.
  19. function onSay(cid, words, param, channel) local pid = getPlayerByNameWildcard(param) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " is not currently online.") return true end doAddIpBanishment(getPlayerIp(pid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " has been permanently banished.") return true end <talkaction words="/banip" event="script" value="nome_do_arquivo.lua"/>
  20. hasProperty = hasItemProperty Serve para você verificar se certo item tem alguma propriedade. As propriedades são essas: CONST_PROP_BLOCKSOLID = 0 CONST_PROP_HASHEIGHT = 1 CONST_PROP_BLOCKPROJECTILE = 2 CONST_PROP_BLOCKPATHFIND = 3 CONST_PROP_ISVERTICAL = 4 CONST_PROP_ISHORIZONTAL = 5 CONST_PROP_MOVABLE = 6 CONST_PROP_BLOCKINGANDNOTMOVABLE = 7 CONST_PROP_SUPPORTHANGABLE = 8 Daí dá para entender o significado do parâmetro num Sua utilização se dá da seguinte forma: hasItemProperty(item.uid, CONST_PROP_BLOCKSOLID) hasItemProperty(item.uid, 0)
  21. Adicione o parâmetro swing="true" no weapons.xml nas wands, rods, arcos e crossbows e se não me engano, bolts e arrows. Por exemplo: <wand id="2182" level="7" mana="2" min="8" max="18" type="earth" event="function" value="default"> <!-- Snakebite Rod --> <vocation id="2"/> </wand> <wand id="2182" level="7" mana="2" min="8" max="18" type="earth" swing="true" event="function" value="default"> <!-- Snakebite Rod --> <vocation id="2"/> </wand> Abraços.
  22. Oneshot

    {Resolvido}

    local config = { [2153] = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_STAT_MAXHEALTH] = 150, [CONDITION_PARAM_SUBID] = 10 } }, [2154] = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_STAT_MAXMANA] = 150, [CONDITION_PARAM_SUBID] = 20 } }, [2155] = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_SKILL_MELEE] = 3, [CONDITION_PARAM_SKILL_DISTANCE] = 3, [CONDITION_PARAM_SUBID] = 30 } }, [2156] = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_STAT_MAGICLEVEL] = 2, [CONDITION_PARAM_SUBID] = 40 } } } local tmp = {} for itemid, conditions in pairs(config) do tmp[itemid] = {} for i = 1, 3 do for condition, parameters in pairs(conditions) do local obj = createConditionObject(condition) setConditionParam(obj, CONDITION_PARAM_TICKS, -1) for parameter, value in pairs(parameters) do setConditionParam(obj, parameter, value) end setConditionParam(obj, CONDITION_PARAM_SUBID, config[itemid][condition][CONDITION_PARAM_SUBID] + i) setConditionParam(obj, CONDITION_PARAM_BUFF, true) tmp[itemid][i] = obj end end end local storage = 30001 function onUse(cid, item, fromPosition, itemEx, toPosition) local status = getCreatureStorage(cid, storage) if status < 0 then doCreatureSetStorage(cid, storage, 0) end if item.itemid == 2158 then doRemoveConditions(cid, false) doCreatureSetStorage(cid, storage, 0) doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE) return true end if not tmp[item.itemid] then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) return true end if status == 3 then doPlayerSendCancel(cid, "You cannot use support runes anymore.") return true end doAddCondition(cid, tmp[item.itemid][status + 1]) doCreatureSetStorage(cid, storage, status + 1) return true end <action itemid="2153-2156;2158" event="script" value="nome_do_arquivo.lua"/> Pronto, sem nenhuma complicação. O código está um pouco "pogado", mas nada que traga problemas. Eu usei os IDs 2153, 2154, 2155, 2156 e 2158 para as "runas", mas você pode mudar livremente. Abraços.
  23. Vai no seu arquivo 100-compat.lua na pasta data/lib e cole essa linha lá: db.executeQuery = db.query Abraços. SkyLigh, Não é de hoje que venho notando que você praticamente reposta o script do tópico, espero que isso não ocorra mais.
  24. Que estranho, o servidor que você atualmente usa está disponível para download para que eu possa achar a solução?
  25. Tente este: local animation = "OWNED!" function onDeath(cid, corpse, deathList) local position = getThingPosition(cid) for i = string.len(animation), 1, -1 do addEvent(function() doSendAnimatedText(position, string.sub(animation, i), COLOR_RED) end, i * 150) end return true end <event type="death" name="Owned" event="script" value="nome_do_arquivo.lua"/> registerCreatureEvent(cid, "Owned")
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...