Postado Junho 19, 2020 4 anos ola pessoal. estou editando o meu sistema de torneio. ele esta funcionando tudo certo 100%. so tem um unico problema. o torneio tem um tempo de 10 minutos para cada batalha 1x1, se passa esse tempo e não houver campeão os 2 players vão ser teleportados para fora do torneio. e aiii que ta o bug. quando isso acontece os 2 players ficam bugado, e se eles morrer para monstros ou para players eles ficam imortal e não morre, e aparece esse erro abaixo na distro: caso alguem possa me ajudar agradeço muito!. doTeleportThing(tid, TOURNEY_CONFIG.ARENA.FIGHT[1]) doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, "IT'S TIME!") doRemovePlayerTourney(tid) else doRemovePlayerTourney(tid) if #getPlayersTourneyByLevel(t.level) == 0 then check_again = true break end end end end elseif #tourney_players >= TOURNEY_CONFIG.GROUP then g = doPlayersGroups(tourney_players, TOURNEY_CONFIG.GROUP)[1] for i = 1, TOURNEY_CONFIG.GROUP do if isPlayer(g) then if (not isInArray(TOURNEY_CONFIG.NOT_ALLOWED, getCreatureSkullType(g))) then doCreatureSetPartyShield(g, (shield == SHIELD_YELLOW and SHIELD_BLUE or SHIELD_YELLOW)) doTeleportThing(g, TOURNEY_CONFIG.ARENA.FIGHT[1]) doPlayerSendTextMessage(g, MESSAGE_INFO_DESCR, "IT'S TIME!") doRemovePlayerTourney(g) else doRemovePlayerTourney(g) if #getPlayersTourneyByLevel(t.level) == 0 then check_again = true break end end end end doSendMagicEffect(TOURNEY_CONFIG.ARENA.FIGHT[1], CONST_ME_TELEPORT) else for i = 1, #players do doTeleportThing(players, TOURNEY_CONFIG.ARENA.EXIT) doPlayerSendTextMessage(players, MESSAGE_STATUS_CONSOLE_ORANGE, "Voc� n�o tem mais oponentes para lutar.") doCreatureSetPartyShield(players, SHIELD_NONE) end doSendMagicEffect(TOURNEY_CONFIG.ARENA.EXIT, CONST_ME_TELEPORT) end end if check_again == true then local new_players = getPlayersInArea(TOURNEY_CONFIG.ARENA.AREA[1], TOURNEY_CONFIG.ARENA.AREA[2]) for i = 1, #new_players do doTeleportThing(new_players, TOURNEY_CONFIG.ARENA.EXIT) doPlayerSendTextMessage(new_players, MESSAGE_STATUS_CONSOLE_ORANGE, "Voc� n�o tem mais oponentes para lutar.") doCreatureSetPartyShield(new_players, SHIELD_NONE) end doSendMagicEffect(TOURNEY_CONFIG.ARENA.EXIT, CONST_ME_TELEPORT) end return true end:onKill Description: [string "LuaInterface::loadBuffer"]:27: attempt to index local 't' (a nil value) stack traceback: [string "LuaInterface::loadBuffer"]:27: in function <[string "LuaInterface::loadBuffer"]:2>
Postado Junho 19, 2020 4 anos Olá @Guilherme HP cole o código completo que está dando erro e me informe a versão da TFS por gentileza. Editado Junho 19, 2020 4 anos por Balkalima (veja o histórico de edições)
Postado Junho 19, 2020 4 anos Autor e otx virsion 1.0 o bug começa na linha -> [Error - CreatureScript Interface] domodlib('TourneyPVP_func') function onKill(cid, target, damage, flags) if not isPlayer(target) or not isPlayer(cid) then return true end addEvent(doCleanArena, 100) local shield = getCreaturePartyShield(cid) local players = getPlayersInArea(TOURNEY_CONFIG.ARENA.AREA[1], TOURNEY_CONFIG.ARENA.AREA[2]) local t = getTourneyLevel() if isInArray(players, target) then for _, dead in pairs(players) do if dead == target then table.remove(players, _) doRemovePlayerTourney(target) end end end local check = true local check_again = false for i = 1, #players do if getCreaturePartyShield(players) ~= shield then check = false break end end local tourney_players = getPlayersTourneyByLevel(t.level) if check == true then local r = t.round_rewards for i = 1, #players do for k = 1, #r do if not isItemStackable(r[k][1]) then for j = 1, r[k][2] do doPlayerAddItem(players, r[k][1], 1) end else doPlayerAddItem(players, r[k][1], r[k][2]) end end doSendAnimatedText(getPlayerPosition(players), "WINNER!", COLOR_ORANGE) end if #tourney_players < TOURNEY_CONFIG.GROUP and #tourney_players > 0 then for i = 1, #tourney_players do local tid = tourney_players if isPlayer(tid) then if (not isInArray(TOURNEY_CONFIG.NOT_ALLOWED, getCreatureSkullType(tid))) then doCreatureSetPartyShield(tid, (shield == SHIELD_YELLOW and SHIELD_BLUE or SHIELD_YELLOW)) doTeleportThing(tid, TOURNEY_CONFIG.ARENA.FIGHT[1]) doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, "IT'S TIME!") doRemovePlayerTourney(tid) else doRemovePlayerTourney(tid) if #getPlayersTourneyByLevel(t.level) == 0 then check_again = true break end end end end elseif #tourney_players >= TOURNEY_CONFIG.GROUP then g = doPlayersGroups(tourney_players, TOURNEY_CONFIG.GROUP)[1] for i = 1, TOURNEY_CONFIG.GROUP do if isPlayer(g) then if (not isInArray(TOURNEY_CONFIG.NOT_ALLOWED, getCreatureSkullType(g))) then doCreatureSetPartyShield(g, (shield == SHIELD_YELLOW and SHIELD_BLUE or SHIELD_YELLOW)) doTeleportThing(g, TOURNEY_CONFIG.ARENA.FIGHT[1]) doPlayerSendTextMessage(g, MESSAGE_INFO_DESCR, "IT'S TIME!") doRemovePlayerTourney(g) else doRemovePlayerTourney(g) if #getPlayersTourneyByLevel(t.level) == 0 then check_again = true break end end end end doSendMagicEffect(TOURNEY_CONFIG.ARENA.FIGHT[1], CONST_ME_TELEPORT) else for i = 1, #players do doTeleportThing(players, TOURNEY_CONFIG.ARENA.EXIT) doPlayerSendTextMessage(players, MESSAGE_STATUS_CONSOLE_ORANGE, "Voc▒ n▒o tem mais oponentes para lutar.") doCreatureSetPartyShield(players, SHIELD_NONE) end doSendMagicEffect(TOURNEY_CONFIG.ARENA.EXIT, CONST_ME_TELEPORT) end end if check_again == true then local new_players = getPlayersInArea(TOURNEY_CONFIG.ARENA.AREA[1], TOURNEY_CONFIG.ARENA.AREA[2]) for i = 1, #new_players do doTeleportThing(new_players, TOURNEY_CONFIG.ARENA.EXIT) doPlayerSendTextMessage(new_players, MESSAGE_STATUS_CONSOLE_ORANGE, "Voc▒ n▒o tem mais oponentes para lutar.") doCreatureSetPartyShield(new_players, SHIELD_NONE) end doSendMagicEffect(TOURNEY_CONFIG.ARENA.EXIT, CONST_ME_TELEPORT) end return true end:onKill Description: [string "LuaInterface::loadBuffer"]:27: attempt to index local 't' (a nil value) stack traceback: [string "LuaInterface::loadBuffer"]:27: in function <[string "LuaInterface::loadBuffer"]:2> aqui o arquivo.. tourneio.xml
Postado Junho 20, 2020 4 anos Aparentemente o erro está na variável t, onde você está mandando nulo para uma função que não deveria, e se eu entendi direito o momento em que isso está acontecendo é em getPlayersTourneyByLevel(t.level). Para ter certeza, faz um print do t e do t.level e mostre a saída. Editado Junho 20, 2020 4 anos por Balkalima (veja o histórico de edições)
Postado Junho 21, 2020 4 anos A função getTourneyLevel esta retornando nula. Tenta: domodlib('TourneyPVP_func') function onKill(cid, target, damage, flags) if not isPlayer(target) or not isPlayer(cid) then return true end addEvent(doCleanArena, 100) local shield = getCreaturePartyShield(cid) local players = getPlayersInArea(TOURNEY_CONFIG.ARENA.AREA[1], TOURNEY_CONFIG.ARENA.AREA[2]) local t = getTourneyLevel() if isInArray(players, target) then for _, dead in pairs(players) do if dead == target then table.remove(players, _) doRemovePlayerTourney(target) end end end local check = true local check_again = false for i = 1, #players do if getCreaturePartyShield(players) ~= shield then check = false break end end if t then local tourney_players = getPlayersTourneyByLevel(t.level) if check == true then local r = t.round_rewards for i = 1, #players do for k = 1, #r do if not isItemStackable(r[k][1]) then for j = 1, r[k][2] do doPlayerAddItem(players, r[k][1], 1) end else doPlayerAddItem(players, r[k][1], r[k][2]) end end doSendAnimatedText(getPlayerPosition(players), "WINNER!", COLOR_ORANGE) end if #tourney_players < TOURNEY_CONFIG.GROUP and #tourney_players > 0 then for i = 1, #tourney_players do local tid = tourney_players if isPlayer(tid) then if (not isInArray(TOURNEY_CONFIG.NOT_ALLOWED, getCreatureSkullType(tid))) then doCreatureSetPartyShield(tid, (shield == SHIELD_YELLOW and SHIELD_BLUE or SHIELD_YELLOW)) doTeleportThing(tid, TOURNEY_CONFIG.ARENA.FIGHT[1]) doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, "IT'S TIME!") doRemovePlayerTourney(tid) else doRemovePlayerTourney(tid) if #getPlayersTourneyByLevel(t.level) == 0 then check_again = true break end end end end elseif #tourney_players >= TOURNEY_CONFIG.GROUP then g = doPlayersGroups(tourney_players, TOURNEY_CONFIG.GROUP)[1] for i = 1, TOURNEY_CONFIG.GROUP do if isPlayer(g) then if (not isInArray(TOURNEY_CONFIG.NOT_ALLOWED, getCreatureSkullType(g))) then doCreatureSetPartyShield(g, (shield == SHIELD_YELLOW and SHIELD_BLUE or SHIELD_YELLOW)) doTeleportThing(g, TOURNEY_CONFIG.ARENA.FIGHT[1]) doPlayerSendTextMessage(g, MESSAGE_INFO_DESCR, "IT'S TIME!") doRemovePlayerTourney(g) else doRemovePlayerTourney(g) if #getPlayersTourneyByLevel(t.level) == 0 then check_again = true break end end end end doSendMagicEffect(TOURNEY_CONFIG.ARENA.FIGHT[1], CONST_ME_TELEPORT) else for i = 1, #players do doTeleportThing(players, TOURNEY_CONFIG.ARENA.EXIT) doPlayerSendTextMessage(players, MESSAGE_STATUS_CONSOLE_ORANGE, "Voc▒ n▒o tem mais oponentes para lutar.") doCreatureSetPartyShield(players, SHIELD_NONE) end doSendMagicEffect(TOURNEY_CONFIG.ARENA.EXIT, CONST_ME_TELEPORT) end end if check_again == true then local new_players = getPlayersInArea(TOURNEY_CONFIG.ARENA.AREA[1], TOURNEY_CONFIG.ARENA.AREA[2]) for i = 1, #new_players do doTeleportThing(new_players, TOURNEY_CONFIG.ARENA.EXIT) doPlayerSendTextMessage(new_players, MESSAGE_STATUS_CONSOLE_ORANGE, "Voc▒ n▒o tem mais oponentes para lutar.") doCreatureSetPartyShield(new_players, SHIELD_NONE) end doSendMagicEffect(TOURNEY_CONFIG.ARENA.EXIT, CONST_ME_TELEPORT) end end return true end:onKill
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.