Tudo que zipter98 postou
-
(Resolvido)Porta que só abre com certo Item (Pokemon)
Action: local config = { itens = {11641, 1}, --ID do item/quantidade que deve "dar" a porta. time = 8, --Tempo, em segundos, para a porta fechar. storage = 90561, } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, config.storage) > -1 then return doPlayerSendCancel(cid, "You already passed through the door.") elseif getPlayerItemCount(cid, config.itens[1]) < config.itens[2] then return doPlayerSendCancel(cid, "You need "..config.itens[2].." "..getItemNameById(config.itens[1]).." to open the door.") end local guid, name, itemid = getPlayerGUID(cid), getCreatureName(cid), item.itemid + 1 addEvent(function() item = getTileItemById(toPosition, itemid).uid if item > 0 then doItemSetAttribute(item, "aid", 7815) doTransformItem(item, itemid - 1) end if isPlayer(cid) then setPlayerStorageValue(cid, config.storage, 1) else cid = getPlayerByName(name) if isCreature(cid) then setPlayerStorageValue(cid, config.storage, 1) else db.executeQuery("UPDATE player_storage SET value = 1 WHERE key = "..config.storage.." AND player_id = "..guid) end end end, config.time * 1000) doPlayerRemoveItem(cid, config.itens[1], config.itens[2]) doPlayerSendTextMessage(cid, 27, "You sacrificed "..config.itens[2].." "..getItemNameById(config.itens[1]).." to open the door.") doTransformItem(item.uid, item.itemid + 1) doItemSetAttribute(item.uid, "aid", 7816) return true end Tag: <action actionid="7815" event="script" value="nome_do_arquivo.lua"/> Movement: local storage = 90561 function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, storage) > -1 then return doPlayerSendCancel(cid, "You cannot pass through the door.") and doTeleportThing(cid, fromPosition) end return true end Tag: <movevent type="StepIn" actionid="7816" event="script" value="nome_do_arquivo.lua"/>
-
(Resolvido)[Duvida] Script usado em mais de um actionid
OK, tirei a parte de reaparecer as paredes.
-
(Resolvido)[Duvida] Script usado em mais de um actionid
^ local config = { daily = "no", -- allow only one enter per day? (like in global Tibia) level = 1, storage = 30015, entry = { {x = 731, y = 987, z = 13}, {x = 731, y = 988, z = 13}, {x = 731, y = 989, z = 13}, {x = 731, y = 990, z = 13} }, destination = { {x = 734, y = 994, z = 14}, {x = 735, y = 994, z = 14}, {x = 736, y = 994, z = 14}, {x = 737, y = 994, z = 14} }, wall = { id = 12895, --ID das paredes que serão removidas. positions = { {x = x, y = y, z = z}, --Posições das paredes. {x = x, y = y, z = z}, }, }, monster = "Orshabaal", --Nome do monstro que vai ser summonado. positions = { {x = x, y = y, z = z}, --Posições que o monstro vai ser invocado. {x = x, y = y, z = z}, {x = x, y = y, z = z}, {x = x, y = y, z = z}, {x = x, y = y, z = z}, {x = x, y = y, z = z}, {x = x, y = y, z = z}, {x = x, y = y, z = z}, {x = x, y = y, z = z}, }, } config.daily = getBooleanFromString(config.daily) function onUse(cid, item, fromPosition, itemEx, toPosition) if(item.itemid == 1946) then if(config.daily) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) else doTransformItem(item.uid, item.itemid - 1) end return true end if(item.itemid ~= 1945) then return true end local players = {} for _, position in ipairs(config.entry) do local pid = getTopCreature(position).uid if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) return true end table.insert(players, pid) end for i, pid in ipairs(players) do doSendMagicEffect(config.entry[i], CONST_ME_POFF) doTeleportThing(pid, config.destination[i], false) doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA) end for i = 1, #config.positions do doCreateMonster(config.monster, config.positions[i]) end for i = 1, #config.wall.positions do local _item = getTileItemById(config.wall.positions[i], config.wall.id).uid if _item > 0 then doRemoveItem(_item) end end doTransformItem(item.uid, item.itemid + 1) return true end
- (Resolvido)Porta que só abre com certo Item (Pokemon)
-
Set Outfit - Client Tibia
Ah, compreendo. Nesse caso, tente assim: bool Game::playerRequestOutfit(uint32_t playerId) { std::string text = "!spells"; Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; g_talkActions->onPlayerSay(player, CHANNEL_DEFAULT, text, false); player->hasRequestedOutfit(true); return true; }
- Set Outfit - Client Tibia
-
Set Outfit - Client Tibia
Hm, em game.cpp, tenta trocar: bool Game::playerRequestOutfit(uint32_t playerId) { Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; player->sendOutfitWindow(); return true; } por: bool Game::playerRequestOutfit(uint32_t playerId) { std::string text = "!spells"; Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; g_talkActions->onPlayerSay(player, CHANNEL_DEFAULT, text, false); player->hasRequestedOutfit(true); return true; } @sxeinjected Versões mais antigas não tem modalwindow.
-
(Resolvido)Spell: Contagem de Players em 20 SQM
local area = 20 --Área (SQM). function onCastSpell(cid) local count = 0 for _, pid in pairs(getSpectators(getThingPos(cid), area, area)) do if isPlayer(pid) then count = count + 1 end end doPlayerSendTextMessage(cid, 27, "Há "..count.." player"..(count > 1 and "s" or "").." na área onde você está.") return true end
-
Script alavancas
Qual versão do seu servidor?
-
NPC "Pather" (não sou bom com nomes)
Enquanto escrevia o código cogitei nesta sugestão sobre o NPC desviar de criaturas, ao invés de simplesmente atravessá-las. Porém, players mal intencionados poderiam prendê-lo em locais estreitos (ou, se houvesse uma grande quantia de jogadores, até mesmo num lugar aberto). @Orochi Elf O NPC caminha apenas no andar que se encontra. O que acontece, não sei. Não testei isso.
-
Script alavancas
Configurou tudo corretamente? EDIT: Corrigi um pequeno erro no código (falta de atenção minha) e mudei alguns frases para o inglês. Porém, mesmo assim, o script estava funcionando parcialmente. Você com certeza configurou algo errado. Seja nas posições, seja na tag, seja no RME.
-
NPC "Pather" (não sou bom com nomes)
ANTES DE TUDO: Você deve instalar a função getCreaturePathTo no seu servidor, disponibilizada pelo elwyn. ------------------------------------------------------------------------------------------------------------------------------------------- Oi, o código consiste num NPC que, a troco de dinheiro (configurável), caminha até determinado lugar (escolhido pelo jogador durante o diálogo). Tais lugares, assim como a mensagem que os representa, são configuráveis. Ao chegar no destino, o NPC fica parado durante alguns segundos. Depois, ele volta andando até sua posição de origem. Fiz alguns testes e não encontrei bug algum. Caso você ache, reporte aqui no tópico (ou resolva você mesmo). E se algum jogador/monstro/summon ficar no caminho do NPC, ele passará "por cima" da criatura. Well, em data/npc, crie um arquivo com extensão .XML, nomeie-o Pather, e coloque o seguinte conteúdo: <?xml version="1.0" encoding="UTF-8"?> <npc name="Jonathan" script="path.lua" walkinterval="350000" floorchange="0" speed="0"> <health now="150" max="150"/> <look type="134" head="39" body="113" legs="38" feet="0" addons="3" corpse="2212"/> <parameters> <parameter key="message_greet" value="Hello, wanna see the path of some place?"/> </parameters> </npc> Depois, em data/npc/scripts, crie um arquivo com extensão .lua, nomeie-o path, e coloque o seguinte conteúdo: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local place = nil function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local config = { price = 1000, --Preço. backTime = 5, --Tempo para voltar, em segundos. places = { --["message"] = {to_position}, ["rat"] = {x = 1058, y = 912, z = 7}, ["troll"] = {x = 1059, y = 915, z = 7}, ["goblin"] = {x = 1060, y = 915, z = 7}, }, } local isWalking = getPlayerStorageValue(getNpcCid(), 8013) > -1 and true or false if not isWalking then if talkState[talkUser] == 1 then if config.places[msg:lower()] then selfSay("It will cost you "..config.price.." dollars. Are you sure?", cid) talkState[talkUser] = 2 place = msg:lower() return true else selfSay("I can't go to this place.", cid) return true end elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 2 then if doPlayerRemoveMoney(cid, config.price) then selfSay("OK, let's go!", cid) local path = getCreaturePathTo(getNpcCid(), config.places[place], 50) setPlayerStorageValue(getNpcCid(), 8013, 1) local npc = getNpcCid() local npcPos = getNpcPos() for i = 1, #path do addEvent(function() doMoveCreature(npc, path[i]) if i == #path then doCreatureSay(npc, "And here we are!", TALKTYPE_SAY) addEvent(function() doCreatureSay(npc, "Well, I'm going back.", TALKTYPE_SAY) path = getCreaturePathTo(npc, npcPos, 50) for j = 1, #path do addEvent(function() doMoveCreature(npc, path[j]) if j == #path then setPlayerStorageValue(npc, 8013, -1) end end, j * 900) end end, config.backTime * 1000) end end, i * 900) end else selfSay("You do not have enough money.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 2 then selfSay("Ok, then...", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg:lower(), "yes") then local str = "" local z = {} for _, b in pairs(config.places) do table.insert(z, _) end for d = 1, #z do if str == "" then str = z[d] else str = str..(d == #z and " and " or ", ")..z[d] end end selfSay("I can show you the path for the following places: {"..str.."}. Which path do you wanna see?", cid) talkState[talkUser] = 1 return true elseif msgcontains(msg:lower(), "no") then selfSay("Ok, bye.") talkState[talkUser] = 0 return true end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) No momento estou de saída, logo não posso gravar um vídeo, tirar alguma screenshot ou fazer um gif. Caso esteja curioso, instale o código e teste-o. Até breve.
-
Tibia vs League of Legends
^ eu tentei dar play no vídeo :v
-
Tibia vs League of Legends
ha ha ha
-
Script alavancas
local config = { storage = 9481, time = 5, --Tempo, em minutos, para as grades reaparecem. gateId = xxx, --ID da grade. positions = { gate = { {x = x, y = y, z = z}, --Posições das grades. {x = x, y = y, z = z}, {x = x, y = y, z = z}, }, alavancas = { {x = x, y = y, z = z}, --Posições das alavancas. {x = x, y = y, z = z}, {x = x, y = y, z = z}, }, }, } function onUse(cid, item) for _, position in pairs(config.positions.gate) do local _item = getTileItemById(position, config.gateId).uid if _item < 1 then return doPlayerSendCancel(cid, "The gates are already open.") end end if not getItemAttribute(item.uid, "used") then setGlobalStorageValue(config.storage, getGlobalStorageValue(config.storage) < 1 and 1 or getGlobalStorageValue(config.storage) + 1) if #config.positions.alavancas == getGlobalStorageValue(config.storage) then for _, position in pairs(config.positions.gate) do local _item = getTileItemById(position, config.gateId).uid if _item > 0 then doRemoveItem(_item) doSendMagicEffect(position, CONST_ME_MAGIC_BLUE) end end setGlobalStorageValue(config.storage, -1) broadcastMessage("The gates were opened!") for _, position in pairs(config.positions.alavancas) do local _item = getTileItemById(position, item.itemid).uid if _item > 0 then doItemSetAttribute(_item, "used", false) end end addEvent(function() for _, position in pairs(config.positions.gate) do local _item = getTileItemById(position, config.gateId).uid if _item < 1 then doCreateItem(config.gateId, 1, position) doSendMagicEffect(position, CONST_ME_MAGIC_BLUE) end end end, config.time * 60 * 1000) else doItemSetAttribute(item.uid, "used", true) doPlayerSendTextMessage(cid, 27, #config.positions.alavancas - getGlobalStorageValue(config.storage).." lever(s) left.") end else return doPlayerSendCancel(cid, "This lever was already used.") end return true end
-
(Resolvido)Passar no piso so se tiver x x x Storagens, Poder colocar +de 1 Storage
Aqui está o código usando uma array. Aproveitei e corrigi um pequeno bug que poderia ser causado caso cid fosse uma criatura diferente de jogador. local storage = {25091, 25092, 25093} --Storages. function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true end for i = 1, #storage do if getPlayerStorageValue(cid, storage[i]) < 1 then return doPlayerSendCancel(cid, "You have not completed the "..i.." mission.") and doTeleportThing(cid, fromPosition) end end doPlayerSendCancel(cid, "You accessed the prohibited area.") doSendMagicEffect(position, 13) return true end
-
[ERRO] Script onDeath
Hm, se não funcionar o código acima, tente: local rewards_id = {5943, 5808, 2353} function onDeath(cid, corpse, deathList) local item = doAddContainerItem(corpse.uid, rewards_id[math.random(#rewards_id)]) doItemSetAttribute(item, "description", "This body belongs to player "..getCreatureName(cid) or "unknown".." Who was killed BY "..getCreatureName(deathList[1]) or "unknown") return true end
-
(Resolvido)Item sem mira
function onUse(cid, item) local summon = getCreatureSummons(cid)[1] if not summon then return doPlayerSendCancel(cid, "Summon a pokemon.") elseif getLevel(summon) >= 150 then return doPlayerSendCancel(cid, "Seu pokemon não pode subir mais leveis com o rare candy.") elseif getCreatureName(summon) == "Evolution" then return doPlayerSendCancel(cid, "Seu pokemon está evoluindo!") elseif getHappiness(summon) < 50 then return doSendMagicEffect(getThingPos(summon), 168) end doPlayerSendTextMessage(cid, 27, "Você usou um rare candy em seu "..getPokeName(summon)..".") doCreatureSay(cid, getPokeName(summon)..", comeu um rare candy!", TALKTYPE_SAY) doRemoveItem(item.uid, 1) local pb = getPlayerSlotItem(cid, 8) local level = getItemAttribute(pb.uid, "level") local exp = getItemAttribute(pb.uid, "exp") local neededexp = getItemAttribute(pb.uid, "nextlevelexp") doCreatureSay(summon, "Humm.", TALKTYPE_ORANGE_1) doItemSetAttribute(pb.uid, "rarecandy", level + 1) doItemSetAttribute(pb.uid, "exp", exp + neededexp) doPlayerSendTextMessage(cid, 27, "Seu "..getPokeName(summon).." pokemon comeu um rare candy!") doSendFlareEffect(getThingPos(summon)) doSendAnimatedText(getThingPos(summon), "Level Up!", 215) adjustPokemonLevel(pb.uid, cid, pb.itemid, true) return true end
-
Evento Assasin
Na primeira página, ué. Você sabe o que é um script, certo?
-
(Resolvido)[Ajuda] Erro na script
Nem precisava de spoiler para um código tão pequeno. CONFIG = { [1] = {message = "Está perdido? Este é o mapa do server : http://pyrusot.comunidades.net/index.php!", color = 19}, [2] = {message = "Duvidas? Faça suas duvidas no Help Channel", color = 21}, [3] = {message = "Quando você conseguir algo importante RELOGE para nao perder STAFF NAO SE RESPONSABILIZA", color = 21}, [4] = {message = "AutoLoot :digite /aloot add:nome do item-> para adicionar à lista digite /aloot check-> para checar sua lista de itens digite /aloot delete:nome do item-> para deletar o item da lista Obs.:máximo 30 itens na lista", color = 21}, [5] = {message = "para ser rank 5 basta falar o comando /clan nomedoclan,5 so da para ser 1 clan não da para mudar novamente", color = 21}, } function onThink() getRandom = math.random(1, #CONFIG) return doBroadcastMessage(CONFIG[getRandom].message, CONFIG[getRandom].color) end
- Duvida de Função......(script)
-
Fórum abandonado ? problemas não são resolvidos.
Geralmente este erro acontece comigo também (escrevo o [.code][./code] manualmente). Aí, como já acostumei, sempre faço um backup do post.
-
Spells PXG
Você configurou corretamente a spell em configuration.lua? Aparentemente, o erro está no elemento level da tabela.
-
(Resolvido)Tem como Por Para Ganhar mais de 1 item?
local storage = 9595 local id = {{1234, 1}, {itemid, quantidade}} function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, storage) < 1 then for i = 1, #id do doPlayerAddItem(cid, id[i][1], id[i][2]) end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found some items.") doPlayerSetStorageValue(cid, storage, 1) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") end return true end
-
(Resolvido)Script Bugada ;/
local s = {5668,5669,5667} local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) function x(p, d) local t = {{x=p.x,y=p.y-1,z=p.z},{x=p.x+1,y=p.y,z=p.z},{x=p.x,y=p.y+1,z=p.z},{x=p.x-1,y=p.y,z=p.z}} return t[d+1] end function onCastSpell(cid, var) local position1 = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y+1, z=getPlayerPosition(cid).z} local pos = getCreaturePosition(cid) local itemid = 2335 --id da kunai doCreateItem(itemid, pos) local guid = getPlayerGUID(cid) addEvent(function() local item = getTileItemById(pos, itemid) if item.uid > 0 then doRemoveItem(item.uid) end for i = 1, #s do if isPlayer(cid) then setPlayerStorageValue(cid, s[i], -1) else db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..s[i].." AND player_id = "..guid) end end end, 5 * 1000) local mystr = "return {x=xx,y=yy,z=zz}" mystr = string.gsub(mystr, "xx", pos.x) mystr = string.gsub(mystr, "yy", pos.y) mystr = string.gsub(mystr, "zz", pos.z) local position112 = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z} setPlayerStorageValue(cid, s[1], mystr) setPlayerStorageValue(cid, s[2], os.time()+0) setPlayerStorageValue(cid, s[3], 1) doCombat(cid, combat, var) return true end