Postado Setembro 21, 2020 4 anos .Qual servidor ou website você utiliza como base? Serve 8.6/The OTX Server Version: (2.6) Qual o motivo deste tópico? Eu estava tentando arrumar um sistema de evento semelhante aos mapa baiak por ai, aquele que aparece a mensagem em cima da posição configurada falando quando será o próximo evento a seguir, efim tava tudo ocorrendo bem porém ao executar no servidor apareceu varios erros sobre o script ao tentar chamar a função global 'HourToNumber', Vou deixar algumas imagens abaixo de exemplo para ajudar vocês a entender e poder facilitar como pra você que está tentado entender e pramin por está me ajudando. Está surgindo algum erro? Se sim coloque-o aqui. Citar Tenho sim esse aqui é o código, logo depois eu vou deixar uma imagem para vocês entender oque eu queria fazer. Você tem o código disponível? Se tiver publique-o aqui: local EventsListalist = { {time = "01:00", name = "Snowball Event"}, {time = "02:00", name = "DesertWar Event"}, {time = "03:00", name = "Capture The Flag"}, {time = "04:00", name = "FireStorm Event"}, {time = "09:00", name = "Defend The Tower"}, {time = "10:00", name = "Snowball Event"}, {time = "11:00", name = "DesertWar Event"}, {time = "12:00", name = "Capture The Flag"}, {time = "13:00", name = "FireStorm Event"}, {time = "15:00", name = "Battlefield Event"}, {time = "16:00", name = "Defend The Tower"}, {time = "17:00", name = "Snowball Event"}, {time = "18:00", name = "DesertWar Event",}, {time = "19:00", name = "Capture The Flag",}, {time = "20:00", name = "FireStorm Event"}, {time = "21:00", name = "Real Castle"}, {time = "22:00", name = "Battlefield Event"}, {time = "23:00", name = "Defend The Tower"} } local position = {x = 129, y = 58, z = 7} function onThink(interval, lastExecution) local people = getPlayersOnline() if #people == 0 then return true end local Count = 0 for _, t in ipairs(EventsListalist) do local eventTime = hourToNumber(t.time) local realTime = hourToNumber(os.date("%H:%M:%S")) if eventTime >= realTime then doPlayerSay(people[1], "Próximo evento ás {"..t.time.."h} "..t.name..", faltam "..timeString(eventTime - realTime)..".", TALKTYPE_MONSTER_SAY, false, 0, position) return true end Count = Count + 1 end return true end Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. Essa é uma imagem que eu peguei de exemplo de como seria esse script, se alguem poder ajudar vou ficar muito grato, só falta tirar esse erro do oThink para o script funcionar.. Rep++ Rep++ ? Quem ajudar vou contribuir por 4 dias dando REP REP só por ter me ajudado, pois estou a muito tempo tentando resolver esse erro.
Postado Setembro 22, 2020 4 anos @Old tibians Em lib. Cria um novo arquivo killlua.lua e adicione. function hourToNumber(str) -- By Killua local hour = (tonumber(str:sub(1,2))*3600) + (tonumber(str:sub(4,5)) * 60) if #str > 5 then hour = hour + tonumber(str:sub(7,8)) end return hour end function timeString(timeDiff,english) local dateFormat = {} if english then dateFormat = { {"day", timeDiff / 60 / 60 / 24}, {"hour", timeDiff / 60 / 60 % 24}, {"minute", timeDiff / 60 % 60}, {"second", timeDiff % 60} } else dateFormat = { {"dia", timeDiff / 60 / 60 / 24}, {"hora", timeDiff / 60 / 60 % 24}, {"minuto", timeDiff / 60 % 60}, {"segundo", timeDiff % 60} } end local out = {} for k, t in ipairs(dateFormat) do local v = math.floor(t[2]) if(v > 0) then table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or '')) end end return table.concat(out) end
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.