Ir para conteúdo

Elwyn

Membro
  • Registro em

  • Última visita

Tudo que Elwyn postou

  1. Elwyn postou uma resposta no tópico em Suporte Tibia OTServer
    TFS 1.x? OTX2, TFS 0.4 ou TFS 0.3.6?
  2. Se for TFS 1.x, já vem com vários comandos. Só checar em talkactions.xml:
  3. Sim, quando ele pisar no tile, um minuto depois ele vai ganhar um de stamina e assim por diante. Isso enquanto estiver no tile, se ele sair, cancela. Por exemplo, ele pisou, começou a contagem, faltando 1s pra receber a stamina ele sai. Vai cancelar e ele não vai receber stamina.
  4. Elwyn postou uma resposta no tópico em Suporte Tibia OTServer
    TFS 1.x: events.xml <event class="Player" method="onGainExperience" enabled="1" /> player.lua function Player:onGainExperience(source, exp, rawExp) local days = { ["Sunday"] = 2, -- Double exp ["Monday"] = 3 -- Triple exp } local bonus = days[os.time("%A")] return exp * (bonus and bonus or 1) end
  5. eventsId = {} local function rechargeStamina(cid) if not isPlayer(cid) then eventsId[cid] = nil return end doPlayerSetStamina(cid, getPlayerStamina(cid) + 1) eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid) end function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if isPlayer(cid) then eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid) end return true end function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor) if isPlayer(cid) then stopEvent(eventsId[cid]) eventsId[cid] = nil end return true end Agora ele só adicionará a cada minuto.
  6. Essas mensagens são do print que deixei sem querer. Não apareceram outras mensagens? Se você fizer essa talkaction: function onSay(cid, words, param) local value = param and tonumber(param) or 1 doPlayerSetStamina(cid, value) return true end Com a seguinte tag: <talkaction access="0-4" words="!teste" event="script" value="stamina.lua" /> E mandar no tibia a seguinte mensagem: Sua stamina muda para 00:20? A propósito, o script que estou usando no OTX é exatamente este: E funciona perfeitamente. Note que é apenas o script anterior sem o print e com um delay maior no regen de stamina.
  7. TFS 1.1: TFS 0.3.6 ~ 0.4: OTX 2: Salve como stamina_tile.lua em movements/script movements.xml: <movevent event="StepIn" itemid="407" script="stamina_tile.lua" /> <movevent event="StepOut" itemid="407" script="stamina_tile.lua" /> Mude itemid="407" para o itemid desejado, caso queira actionid é só mudar de itemid="id do item" para actionid="id da action".
  8. Elwyn postou uma resposta no tópico em Suporte Tibia OTServer
    Nossa, desculpa. Tinha esquecido dessa dúvida. Me mande PM pra eu te adicionar skype e te ajudar melhor. Teste o script agora e me mande todos os prints que deu no console: local function Teleport(cid) doSendAnimatedText(getPlayerPosition(cid), "Aaaaah...", TEXTCOLOR_BLUE) local templo = {x = 442, y = 549, z = 7} for j = 0, 60 do starting = {x = 839 + j, y = 952, z = 7, stackpos = 253} for i = 0, 60 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 61 do starting = {x = 1128 + j, y = 1120, z = 6, stackpos = 253} for i = 0, 6 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 14 do starting = {x = 1151 + j, y = 1115, z = 6, stackpos = 253} for i = 0, 5 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 14 do starting = {x = 1151 + j, y = 1127, z = 6, stackpos = 253} for i = 0, 5 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 49 do starting = {x = 1134 + j, y = 1120, z = 5, stackpos = 253} for i = 0, 6 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 14 do starting = {x = 1151 + j, y = 1115, z = 5, stackpos = 253} for i = 0, 5 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 14 do starting = {x = 1151 + j, y = 1127, z = 5, stackpos = 253} for i = 0, 5 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end return true end function onKill(cid, target, lastHit) local monstros = { "Gran Tower", "gran tower" } local nome = getCreatureTarget(cid) and getCreatureName(getCreatureTarget(cid)) or "" print("Creatuer name: " .. nome) if isInArray(monstros, nome) and isMonster(target) then if getPlayerStorageValue(cid, 13340) ~= 1 then print("Player storage ~= 1") setGlobalStorageValue(13340, getPlayerGuildId(cid)) granEffect(cid) if getPlayerStorageValue(cid, 13340) == 0 then print("Player storage == 0") stopEvent(events[cid]) print("Error? " .. events[cid]) doSendMagicEffect(getCreaturePosition(cid), 47) broadcastMessage("O player ".. getPlayerName(cid) .." conquistou o Gran Castle, e todos membros da guild ".. getPlayerGuildName(cid) .." acabam de receber a Gran Aura.") end addEvent(Teleport, 1000, cid) end end return true end
  9. Você usa qual TFS? Veja em luascripts.cpp qual é o comando para fazer uma query na database. Procura por e poste aqui o que você achar.
  10. Só trocar level por skill_axe, ou skill_sword etc
  11. Nenhum erro no console? Use a db.Query que postei acima por enquanto.
  12. Poste aqui o que a função retornou no seu caso para eu entender em que o padrão está errado.
  13. Dar print(getHighscoreString(1)) não retorna nada ou o padrão que eu te passei não retorna nada? Pode ser por database db.Query("select name from players order by level desc limit 1;")
  14. Na source tem classes e métodos responsáveis pela conexão do servidor. É quem lida com a "conversa" com o cliente e traduz para ações que o servidor deve tomar. A partir da versão 10.54 a "língua" que o cliente "conversa" com o servidor mudou. Essa é a parte mais difícil de atualizar para 10.54+
  15. No servidor de teste existe um player registrado que não possui acesso de GM, CM ou God? Teste para as outras skills.
  16. Elwyn postou uma resposta no tópico em Suporte Tibia OTServer
    Dê print(right_item == nil) print(left_item == nil) Logo depois da definição dessas variáveis e tente reproduzir o erro e poste o erro aqui de novo. (Incluindo o true ou false que vai aparecer em cima do erro)
  17. skillId 8 existe? Ela retornou alguma string? Print o getHighscoreString(8) e veja o resultado
  18. Veja em party.cpp na função onShareExperience
  19. Configuração tipo?
  20. local highscore_player = string.match(getHighscoreString(skillId), "1. %d+ -- (.-)\n")
  21. Elwyn postou uma resposta no tópico em Suporte Tibia OTServer
    getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_LEFT).count >= 10 or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_RIGHT).count >= 10 not getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_LEFT).count >= 10 or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_RIGHT).count >= 10 Quando o player não tem nada na mão esquerda ou direita dará esse erro. O que você pode fazer é garantir que existe algo na mão esquerda ou direita antes de comparar. local left_item = getPlayerSlotItem(cid, CONST_SLOT_LEFT) local right_item = getPlayerSlotItem(cid, CONST_SLOT_RIGHT) if (left_item and left_item.itemid == 2160 and left_item.count >= 10) or (right_item and right_item.itemid == 2160 and right_item.count >= 10) then doCreatureSay(cid, 'Its time to play', TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) else doCreatureSay(cid, 'You dont have '..crystalparaapostar..' crystal coins or more in your hand', TALKTYPE_ORANGE_1) end
  22. luascripts.cpp int32_t LuaInterface::luaGetHighscoreString(lua_State* L) { //getHighscoreString(skillId) uint16_t skillId = popNumber(L); if(skillId <= SKILL__LAST) lua_pushstring(L, g_game.getHighscoreString(skillId).c_str()); else lua_pushboolean(L, false); return 1; } game.cpp std::string Game::getHighscoreString(uint16_t skill) { Highscore hs = highscoreStorage[skill]; std::stringstream ss; ss << "Highscore for " << getSkillName(skill) << "\n\nRank Level - Player Name"; for(uint32_t i = 0; i < hs.size(); ++i) ss << "\n" << (i + 1) << ". " << hs[i].second << " - " << hs[i].first; ss << "\n\nLast updated on:\n" << std::ctime(&lastHighscoreCheck); return ss.str(); } Uma string com o seguinte formato: "Highscore for nome da skill Rank Level - Player Name 1. 100 - Player 1 2. 99 - Player 2 3. 98 - Player 3 Last update on: tempo" String acima é um exemplo.
  23. if getPlayerStorageValue(cid, 3509) > 0 then math.randomseed(os.time()) local rand = math.random(1,45) if rand == 1 then doPlayerAddItem(cid, 2488, 1) -- Crown Legs doSendMagicEffect(getPlayerPosition(cid), 12) end end
  24. Antes de usar o math.random() usa o math.randomseed(os.time()). Sobre o porquê de ser assim: Computadores não geram nada realmente aleatório. O que o math.random faz é pegar um numero para usar como base para gerar outros números. Se o número que ele pega, o chamado seed, for sempre igual, então ele vai gerar números sempre iguais.
  25. Elwyn postou uma resposta no tópico em Suporte Tibia OTServer
    Você mudou algo a mais. Mande o script de como está agora. Ou é possível que tenha dado erro no console. Veja se tem algum erro no console.

Informação Importante

Confirmação de Termo