Postado Abril 1, 2021 4 anos .Qual servidor ou website você utiliza como base? The OTServBR - Global - Version: (Based on TFS 1.3) Qual o motivo deste tópico? Não funciona o Save Server Está surgindo algum erro? Se sim coloque-o aqui. Citar Não. Você tem o código disponível? Se tiver publique-o aqui: local function ServerSave() if configManager.getBoolean(configKeys.SERVER_SAVE_CLEAN_MAP) then cleanMap() end if configManager.getBoolean(configKeys.SERVER_SAVE_CLOSE) then Game.setGameState(GAME_STATE_CLOSED) end if configManager.getBoolean(configKeys.SERVER_SAVE_SHUTDOWN) then Game.setGameState(GAME_STATE_SHUTDOWN) end -- Updating daily reward next server save. updateGlobalStorage(DailyReward.storages.lastServerSave, os.time()) -- Reset gamestore exp boost count. db.query('UPDATE `player_storage` SET `value` = 0 WHERE `player_storage`.`key` = 51052') end local function ServerSaveWarning(time) -- minus one minutes local remaningTime = tonumber(time) - 60000 if configManager.getBoolean(configKeys.SERVER_SAVE_NOTIFY_MESSAGE) then local message = "Server is saving game in " .. (remaningTime/60000) .." minute(s). Please logout." Webhook.send("Server save", message, WEBHOOK_COLOR_WARNING) Game.broadcastMessage(message, MESSAGE_GAME_HIGHLIGHT) end -- if greater than one minute, schedule another warning -- else the next event will be the server save if remaningTime > 60000 then addEvent(ServerSaveWarning, 60000, remaningTime) else addEvent(ServerSave, 60000) end end -- Function that is called by the global events when it reaches the time configured -- interval is the time between the event start and the the effective save, it will send an notify message every minute local serversave = GlobalEvent("serversave") function serversave.onTime(interval) local remaningTime = configManager.getNumber(configKeys.SERVER_SAVE_NOTIFY_DURATION) * 60000 if configManager.getBoolean(configKeys.SERVER_SAVE_NOTIFY_MESSAGE) then local message = "Server is saving game in " .. (remaningTime/60000) .." minute(s). Please logout." Webhook.send("Server save", message, WEBHOOK_COLOR_WARNING) Game.broadcastMessage(message, MESSAGE_GAME_HIGHLIGHT) end addEvent(ServerSaveWarning, 60000, remaningTime) -- Schedule next event in 1 minute(60000) return not configManager.getBoolean(configKeys.SERVER_SAVE_SHUTDOWN) end serversave:time("21:20:00") serversave:register() Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. Não sei onde eu posso chamar essa função, eu troquei a antiga que era SAVE.LUA por esse código mas mesmo assim o servidor não chama a função. Meu servidor não tem o GLOBALEVENTS.XML.
Postado Abril 1, 2021 4 anos Só colocar na pasta scripts/globalevents e pronto. e ajustar o horário lá onde está o time (21:20) http://baiakuza.com/IP: baiakuza.com TIBIA: 10.96 Baiak Custom [ High Exp Rate ]
Postado Abril 1, 2021 4 anos Autor Em 01/04/2021 em 04:43, Skydangerous disse: Só colocar na pasta scripts/globalevents e pronto. e ajustar o horário lá onde está o time (21:20) Bom dia Sky. Eu coloquei ele la dentro mas nada acontece. Esta dentro da pasta \data\scripts\globalevents\others\serversave.lua Configurei para teste o save as 11 da manha mas simplesmente nada acontece. Nem erro no log aparece. EDIT: Joguei também na pasta anterior e não deu certo. Agora não sei se o horário que coloco é o tempo online ou a hora especifica, se o script ta errado ou se não esta chamando em algum local. EDIT2: Quando voltei para casa percebi o erro no script saveserver. Agora estou vendo que esta chamando, mas deu o seguinte erro: /home/otmanager/globalfox1264/data/scripts/globalevents/serversave.lua:callback ...r/globalfox1264/data/scripts/globalevents/serversave.lua:41: attempt to index global 'Webhook' (a nil value) stack traceback: [C]: in function '__index' ...r/globalfox1264/data/scripts/globalevents/serversave.lua:41: in function <...r/globalfox1264/data/scripts/globalevents/serversave.lua:37> Sabe como posso resolve-lo? Agradecido desde já! Editado Abril 1, 2021 4 anos por dscmanga (veja o histórico de edições)
Postado Abril 2, 2021 4 anos Autor Solução Consigui fazer o save server com a função abaixo. Só criei ela dentro a pasta scrits\globalevents com o nome serversave.lua serversave.lua local function ServerSave() if configManager.getBoolean(configKeys.SERVER_SAVE_CLEAN_MAP) then cleanMap() end if configManager.getBoolean(configKeys.SERVER_SAVE_CLOSE) then Game.setGameState(GAME_STATE_CLOSED) end if configManager.getBoolean(configKeys.SERVER_SAVE_SHUTDOWN) then Game.setGameState(GAME_STATE_SHUTDOWN) end -- Updating daily reward next server save. updateGlobalStorage(DailyReward.storages.lastServerSave, os.time()) -- Reset gamestore exp boost count. db.query('UPDATE `player_storage` SET `value` = 0 WHERE `player_storage`.`key` = 51052') end local function ServerSaveWarning(time) -- minus one minutes local remaningTime = tonumber(time) - 60000 if configManager.getBoolean(configKeys.SERVER_SAVE_NOTIFY_MESSAGE) then Game.broadcastMessage("Server is saving game in " .. (remaningTime/60000) .." minute(s). Please logout.", MESSAGE_STATUS_WARNING) end -- if greater than one minute, schedule another warning -- else the next event will be the server save if remaningTime > 60000 then addEvent(ServerSaveWarning, 60000, remaningTime) else addEvent(ServerSave, 60000) end end -- Function that is called by the global events when it reaches the time configured -- interval is the time between the event start and the the effective save, it will send an notify message every minute local serversave = GlobalEvent("serversave") function serversave.onTime(interval) local remaningTime = configManager.getNumber(configKeys.SERVER_SAVE_NOTIFY_DURATION) * 60000 if configManager.getBoolean(configKeys.SERVER_SAVE_NOTIFY_MESSAGE) then Game.broadcastMessage("Server is saving game in " .. (remaningTime/60000) .." minute(s). Please logout.", MESSAGE_STATUS_WARNING) end addEvent(ServerSaveWarning, 60000, remaningTime) -- Schedule next event in 1 minute(60000) return not configManager.getBoolean(configKeys.SERVER_SAVE_SHUTDOWN) end serversave:time("12:00:00") serversave:register() Após isso, no servidor LINUX criar o arquivo restart.sh antes da pasta data e executar o comando chmod +x restart.sh no seu linux restart.sh #!/bin/bash while true do ./theforgottenserver; done Editado Abril 3, 2021 4 anos por dscmanga (veja o histórico de edições)
Postado Abril 2, 2021 4 anos Em 01/04/2021 em 14:11, dscmanga disse: Bom dia Sky. Eu coloquei ele la dentro mas nada acontece. Esta dentro da pasta \data\scripts\globalevents\others\serversave.lua Configurei para teste o save as 11 da manha mas simplesmente nada acontece. Nem erro no log aparece. EDIT: Joguei também na pasta anterior e não deu certo. Agora não sei se o horário que coloco é o tempo online ou a hora especifica, se o script ta errado ou se não esta chamando em algum local. EDIT2: Quando voltei para casa percebi o erro no script saveserver. Agora estou vendo que esta chamando, mas deu o seguinte erro: /home/otmanager/globalfox1264/data/scripts/globalevents/serversave.lua:callback ...r/globalfox1264/data/scripts/globalevents/serversave.lua:41: attempt to index global 'Webhook' (a nil value) stack traceback: [C]: in function '__index' ...r/globalfox1264/data/scripts/globalevents/serversave.lua:41: in function <...r/globalfox1264/data/scripts/globalevents/serversave.lua:37> Sabe como posso resolve-lo? Agradecido desde já! Mas não adianta tu colocar um horário e sua maquina estiver com horário diferente, tipo exemplo (Ubuntu por padrao vem um GMT diferente.. e preciso colocar para pegar Horário de Brasília). http://baiakuza.com/IP: baiakuza.com TIBIA: 10.96 Baiak Custom [ High Exp Rate ]
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.