Ir para conteúdo

zipter98

Membro
  • Registro em

  • Última visita

Tudo que zipter98 postou

  1. 2º: local config = { slot = xxx, --Slot. items = {2580, 7573}, } function onLogin(cid) local item = getPlayerSlotItem(cid, config.slot) if item.uid > 0 and item.itemid == config.items[1] then doTransformItem(item.uid, config.items[2]) end return true end
  2. Ah, entendi. Poderia passar o link deste novo Ditto System? Irei adaptar o comando a ele.
  3. Desculpe, não vi seu comentário. Não entendi muito bem seu pedido, poderia explicá-lo com outras palavras? O que seria esse "ehditto"?
  4. zipter98 postou uma resposta no tópico em Playground (Off-topic)
    9 resultados (0,49 segundos) rip
  5. Ops, esqueci de colocar uma informação para ser imprimida. Se possível, atualize o código novamente.
  6. Verifique se a posição é andável usando isWalkable (tem o código desta função por aqui).
  7. Certa vez vi que retornar falso em onEquip e onDeEquip não alterava a funcionalidade. Talvez seja este o motivo pelo qual o código não funcionou. Se você tiver as sources do seu servidor, você pode instalar este creatureevent e usar o seguinte código: data/creaturescripts/scripts: local config = { helmetId = xxx, --ID do helmet. pos = {{x = x, y = y, z = z}, {x = x, y = y, z = z}}, --{{fromPos}, {toPos}} } function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos) local headItem = getPlayerSlotItem(cid, CONST_SLOT_HEAD) if headItem.uid > 0 then if isInRange(getThingPos(cid), config.pos[1], config.pos[2]) and headItem.itemid == config.helmetId and headItem.uid == item.uid then return false end end return true end Tag: <event type="moveitem" name="moveHelmet" event="script" value="nome_do_arquivo.lua"/> E não se esqueça de registrar o evento em login.lua.
  8. Apenas os participantes do duelo não conseguem se atacar? Se possível, troque esta parte do creaturescript: function onTarget(cid, target) if isInDuel(cid) or isPlayer(target) and isInDuel(target) then return getDuelOpponent(cid) == target end return true end por esta: function onTarget(cid, target) print(0) if isInDuel(cid) or isPlayer(target) and isInDuel(target) then print(1) print(getCreatureName(cid).." - cid (VS: "..getDuelOpponent(cid)..")") print(getCreatureName(target).." - target (VS: "..getDuelOpponent(target)..")") return getDuelOpponent(cid) == target end return true end E informe o que for imprimido no console. PS: Recomendo targetar apenas uma vez, para não spammar muito a distro.
  9. function onKill(cid, target) if isPlayer(cid) and isPlayer(target) then broadcastMessage(getCreatureName(cid).." killed "..getCreatureName(target)) end return true end function onLogin(cid) registerCreatureEvent(cid, "killPlayer") return true end Tags: <event type="kill" name="killPlayer" script="nome_do_arquivo.lua"/> <event type="login" name="killPlayerLogin" event="script" value="nome_do_arquivo.lua"/>
  10. Você alterou a talkaction e a lib? Pelo menos aqui, ambos os comandos estão funcionando perfeitamente (para o rank ser atualizado, o jogador deve deslogar). Sobre o problema dos jogadores não poderem se atacar normalmente, fiz uma pequena alteração no creaturescript para "corrigir" isso.
  11. Já vi todos os erros. Foram, basicamente, total falta de atenção minha. Como estou de saída no momento, postarei a solução mais tarde. EDIT: Pronto, códigos corrigidos. Agora o sistema está funcionando perfeitamente.
  12. Não li o código inteiro, logo é apenas uma suposição. Troque: local arena_room = item.aid por: local arena_room = item.actionid if not arena_room then return true end
  13. Desculpe a demora, estive ocupado com outras coisas e não pude me concentrar no seu sistema. Ele já está, digamos, uns 95% pronto. Falta apenas finalizar um bloco de código e fazer uma rápida revisão. Como não tenho meios para testá-lo, deixarei esta tarefa para você. edit: Confesso que, por ser um código um pouco grande, fiquei com preguiça de revisá-lo. Também gostaria de informar que os comandos de duelo foram escritos em talkaction, visto que não faço alterações no client. Primeiramente, comandos e uma breve explicação com exemplos: /duel invite [playername] --Enviar solicitação de duelo. e.g: /duel invite Cray /duel accept [playername] --Aceitar solicitação de duelo. e.g: /duel accept Zipter /duel refuse [playername] --Recusar solicitação de duelo. eg.: /duel refuse Zipter /duel rank [win/lose] --Ver rank de wins ou loses. e.g: /duel rank win /duel check --Checar status de duelo (wins/loses e winning ratio). /duel giveup --Desistir. Biblioteca do sistema: data/lib: DUEL_MAX_DISTANCE = 7 --Distância máxima entre os dois jogadores para enviarem convites de duelo/aceitarem solicitações de duelo. DUEL_RANK_LIMIT = 10 --Limite do rank de wins/loses. DUEL_START_TIME = 5 --Tempo, em segundos, para o duelo começar. DUEL_WIN_STORAGE = 4919 DUEL_LOSE_STORAGE = 4920 DUEL_STORAGE = 4921 DUEL_INVITE_STORAGE = 4922 DUEL_HP_STORAGE = 4923 DUEL_MANA_STORAGE = 4924 function table.insert(table, value) table[#table + 1] = value end function getWinningRatio(win, lose) --Halls Santos if(type(win) ~= "number" or type(lose) ~= "number") then return nil, error("You need to specify a number value.") end if(win == 0 and lose == 0) then return 0.0 end local ratio = win / (win + lose) * 100 local i = 4 if(math.floor(ratio) < 10) then i = 3 end ratio = tostring(ratio):sub(1, i) return tonumber(ratio) end function sendDuelInvite(cid, target) if isPlayer(cid) and isPlayer(target) then doPlayerSendTextMessage(target, 27, getCreatureName(cid).." sent you a duel invitation. To accept, say /duel accept "..getCreatureName(cid)) local sto, str = getPlayerStorageValue(target, DUEL_INVITE_STORAGE), "" if tonumber(sto) then setPlayerStorageValue(target, DUEL_INVITE_STORAGE, getCreatureName(cid)) else sto = sto:explode("/") table.insert(sto, getCreatureName(cid)) for i = 1, #sto do if str == "" then str = sto[i] else str = str.."/"..sto[i] end end setPlayerStorageValue(target, DUEL_INVITE_STORAGE, str) end end end function isInDuel(cid) return getPlayerStorageValue(cid, DUEL_STORAGE) > -1 end function getInvitation(cid, target) if isPlayer(cid) and isPlayer(target) then local sto = getPlayerStorageValue(cid, DUEL_INVITE_STORAGE) if tonumber(sto) then return false end sto = sto:explode("/") return isInArray(sto, getCreatureName(target)) end return false end function removeInvitation(cid, target) if isPlayer(cid) and isPlayer(target) then local sto, str = getPlayerStorageValue(cid, DUEL_INVITE_STORAGE):explode("/"), "" table.remove(sto, getCreatureName(target)) for i = 1, #sto do if str == "" then str = sto[i] else str = str.."/"..sto[i] end end setPlayerStorageValue(cid, DUEL_INVITE_STORAGE, str) end end function duelTimer(time, cid, pid) if time < 0 then return true end doSendAnimatedText(getThingPos(cid), time == 0 and "START!" or time, 215) doSendAnimatedText(getThingPos(pid), time == 0 and "START!" or time, 215) addEvent(duelTimer, 1000, time - 1, cid, pid) end function startDuel(cid, target) duelTimer(DUEL_START_TIME, cid, target) setPlayerStorageValue(cid, DUEL_STORAGE, 1) setPlayerStorageValue(target, DUEL_STORAGE, 1) addEvent(function() if isPlayer(cid) and isPlayer(target) then setPlayerStorageValue(cid, DUEL_STORAGE, target) setPlayerStorageValue(cid, DUEL_HP_STORAGE, getCreatureHealth(cid)) setPlayerStorageValue(cid, DUEL_MANA_STORAGE, getCreatureMana(cid)) setPlayerStorageValue(cid, DUEL_INVITE_STORAGE, -1) setPlayerStorageValue(target, DUEL_STORAGE, cid) setPlayerStorageValue(target, DUEL_HP_STORAGE, getCreatureHealth(target)) setPlayerStorageValue(target, DUEL_MANA_STORAGE, getCreatureMana(target)) setPlayerStorageValue(target, DUEL_INVITE_STORAGE, -1) end end, DUEL_START_TIME * 1000) end function getDuelOpponent(cid) return getPlayerStorageValue(cid, DUEL_STORAGE) end function getPlayerWins(cid) return getPlayerStorageValue(cid, DUEL_WIN_STORAGE) < 0 and 0 or getPlayerStorageValue(cid, DUEL_WIN_STORAGE) end function getPlayerLoses(cid) return getPlayerStorageValue(cid, DUEL_LOSE_STORAGE) < 0 and 0 or getPlayerStorageValue(cid, DUEL_LOSE_STORAGE) end function endDuel(winner, loser) if isPlayer(winner) and isPlayer(loser) then setPlayerStorageValue(winner, DUEL_WIN_STORAGE, getPlayerWins(winner) + 1) setPlayerStorageValue(winner, DUEL_STORAGE, -1) doCreatureAddHealth(winner, getPlayerStorageValue(winner, DUEL_HP_STORAGE) - getCreatureHealth(winner)) doCreatureAddMana(winner, getPlayerStorageValue(winner, DUEL_MANA_STORAGE) - getCreatureMana(winner)) setPlayerStorageValue(loser, DUEL_STORAGE, -1) setPlayerStorageValue(loser, DUEL_LOSE_STORAGE, getPlayerLoses(loser) + 1) doCreatureAddHealth(loser, getPlayerStorageValue(loser, DUEL_HP_STORAGE) - getCreatureHealth(loser)) doCreatureAddMana(loser, getPlayerStorageValue(loser, DUEL_MANA_STORAGE) - getCreatureMana(loser)) doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_ORANGE, "You won the duel =] Victories: "..getPlayerWins(winner)..".") doPlayerSendTextMessage(loser, MESSAGE_STATUS_CONSOLE_ORANGE, "You lost the duel =[ Defeats: "..getPlayerLoses(loser)..".") doSendAnimatedText(getThingPos(winner), "WINNER", 255) doSendAnimatedText(getThingPos(loser), "LOSER", 255) end end Creaturescript: data/creaturescripts/scripts: function onLogin(cid) if isInDuel(cid) then setPlayerStorageValue(cid, DUEL_STORAGE, -1) end registerCreatureEvent(cid, "duelStatsChange") registerCreatureEvent(cid, "duelTarget") return true end function onLogout(cid) if isInDuel(cid) then return doPlayerSendCancel(cid, "You cannot logout during a duel.") and false end return true end function onTarget(cid, target) if isInDuel(cid) or isPlayer(target) and isInDuel(target) then return getDuelOpponent(cid) == target end return true end function onStatsChange(cid, attacker, type, combat, value) if type == STATSCHANGE_HEALTHLOSS and isPlayer(cid) and isInDuel(cid) or isPlayer(attacker) and isInDuel(attacker) then if getDuelOpponent(cid) ~= target then return false end if value >= getCreatureHealth(cid) then endDuel(attacker, cid) return false end end return true end Tags: <event type="login" name="duelLogin" event="script" value="nome_do_arquivo.lua"/> <event type="logout" name="duelLogout" event="script" value="nome_do_arquivo.lua"/> <event type="statschange" name="duelStatsChange" event="script" value="nome_do_arquivo.lua"/> <event type="target" name="duelTarget" event="script" value="nome_do_arquivo.lua"/> Talkaction: data/talkactions/scripts: Tag: <talkaction words="/duel" event="script" value="nome_do_arquivo.lua"/>
  14. Não se esqueça de registrar o evento no arquivo .XML do monstro. local config = { pos = {{x = x, y = y, z = z}, {x = x, y = y, z = z}}, --{{fromPos}, {toPos}} storage = {9281, 1}, --{key, value}, } function onDeath(cid) for x = config.pos[1].x, config.pos[2].x do for y = config.pos[1].y, config.pos[2].y do local pid = getTopCreature({x = x, y = y, z = config.pos[1].z}).uid if pid > 0 and isPlayer(pid) then setPlayerStorageValue(pid, config.storage[1], config.storage[2]) end end end return true end
  15. local monster = { name = "Monk", pos = {x = x, y = y, z = z}, } function onTime() local c = getTopCreature(monster.pos).uid if c > 0 and isMonster(c) and getCreatureName(c) == monster.name then doRemoveCreature(c) end return true end
  16. Ah, já vi o erro: esqueci de colocar uma vírgula na linha 9. Código corrigido, agora vai funcionar. PS: Bugs como este, geralmente, são informados no console. Você não deve ter reparado.
  17. zipter98 postou uma resposta no tópico em Suporte Tibia OTServer
    Será uma storage global ou individual?
  18. Erros? Como ficou o resultado?
  19. Como o jogador chamaria o outro para duelar? Nos servidores de pokémon, é pelo order (um item). Seria da mesma maneira?
  20. local config = { showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')), showLevel = "yes", showVocations = "yes" } config.showLevel, config.showVocations = getBooleanFromString(config.showLevel), getBooleanFromString(config.showVocations) function onSay(cid, words, param, channel) local i, position, vocations, vocStr = 0, 1, {}, "" for _, pid in ipairs(getPlayersOnline()) do i = i + 1 if(vocations[getPlayerVocation(pid)] ~= nil) then vocations[getPlayerVocation(pid)] = vocations[getPlayerVocation(pid)] + 1 else vocations[getPlayerVocation(pid)] = 1 end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i * 2) .. " player" .. ((i * 2) and "s" or "") .. " online:") if(config.showVocations) then for vocId, quant in pairs(vocations) do vocStr = vocStr .. ""..getVocationInfo(vocId).name.." ["..(quant * 2).."], " end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Vocations: "..vocStr:gsub(", $", ".")) end return true end
  21. Como funciona, você mesmo explicou no tópico. Tags: <movevent type="Equip" itemid="ID_DO_ITEM" slot="feet" event="script" value="nome_do_arquivo.lua"/> <movevent type="DeEquip" itemid="ID_DO_ITEM" slot="feet" event="script" value="nome_do_arquivo.lua"/>
  22. movements: local config = { interval = 5, --Intervalo, em segundos, do efeito e mensagem. effect = xxx, --Efeito. message = "oi", --Mensagem. events = {}, } function sendMessageAndEff(cid) if isPlayer(cid) then doCreatureSay(cid, config.message, TALKTYPE_MONSTER) doSendMagicEffect(getThingPos(cid), config.effect) config.events[cid] = addEvent(sendMessageAndEff, config.interval * 1000, cid) end end function onEquip(cid, item, slot) sendMessageAndEff(cid) return true end function onDeEquip(cid, item, slot) if config.events[cid] then stopEvent(config.events[cid]) end return true end
  23. local time, storage = 3, 9471 function onStepIn(cid, item, position, fromPosition) if getPlayerStorageValue(cid, storage) > os.time() then doPlayerSendCancel(cid, "Wait "..getPlayerStorageValue(cid, storage) - os.time().." second(s) to pass here again.") doTeleportThing(cid, fromPosition) else local message = getCreatureName(cid).." esta invadindo o castelo." if getPlayerGuildId(cid) > 0 then message = getCreatureName(cid)..", da guild "..getPlayerGuildName(cid)..", esta invadindo o castelo." end for _, pid in pairs(getPlayersOnline()) do if pid ~= cid then doPlayerSendTextMessage(pid, 27, message) end end setPlayerStorageValue(cid, storage, os.time() + time) end return true end
  24. Ambas as variáveis já estão configuradas como deviam: time para o tempo de realização da quest, e interval o tempo para fazê-la novamente. wtf? Para time ser configurado em minutos: Troque: timer(config.time) por: timer(config.time * 60)

Informação Importante

Confirmação de Termo