tenta esse mano nao deu tempo de testarlocal config = {broadcast = "no"
}
config.broadcast = getBooleanFromString(config.broadcast)
local function executeSave(seconds)
if(seconds == 0) then
doSaveServer()
return true
end
if(seconds == 120 or seconds == 30) then
doBroadcastMessage("[AVISO] Server ira salver daki " .. seconds .. " segundos, por favor fique em local seguro!")
end
seconds = seconds - 30
if(seconds >= 0) then
addEvent(executeSave, 30 * 1000, seconds)
doBroadcastMessage("[AVISO] Servidor salvado com sucesso!")
end
end
function onThink(interval, lastExecution, thinkInterval)
if(not config.broadcast) then
doSaveServer()
return true
end
executeSave(120)
return true
end
Não funciono, ele nem manda a msg tb.
Tente esse
function executeSave()doSaveServer()
doBroadcastMessage("[AUTO MESSAGE] Server salvo.")
return true
end
function onThink(interval, lastExecution, thinkInterval)
doBroadcastMessage("[AUTO MESSAGE] Server vai ser salvo")
addEvent(executeSave, 30000)
return true
end
ou esse
function executeSave(seconds)doSaveServer()
doBroadcastMessage("[AUTO MESSAGE] Server salvo.")
return true
end
function onThink(interval, lastExecution, thinkInterval)
doBroadcastMessage("[AUTO MESSAGE] Save server daki " .. seconds .. " segundos, ")
addEvent(executeSave, 30 * 1000, seconds)
return true
end
Editado Fevereiro 21 por Zmovir
Também não deu, queria mesmo mudar aquele script que postei.
Ultimata tentativa tenta esse aki
local config = {broadcast = {120, 30},
shallow = "no",
delay = 120,
events = 30
}
config.shallow = getBooleanFromString(config.shallow)
local function executeSave(seconds)
if(isInArray(config.broadcast, seconds)) then
local text = ""
if(not config.shallow) then
text = "[Auto Save]"
else
text = "O"
end
text = text .. " Serve irá salvar em " .. seconds .. " segundos, porfavor aguarde!"
doBroadcastMessage(text)
end
if(seconds > 0) then
addEvent(executeSave, config.events * 1000, seconds - config.events)
else
doSaveServer(config.shallow)
doBroadcastMessage("[AVISO] Servidor salvado com sucesso!")
end
end
function onThink(interval)
if(table.maxn(config.broadcast) == 0) then
doSaveServer(config.shallow)
else
executeSave(config.delay)
end
return true
end
info
Grupo: Conde
Registrado: 30/06/11
Posts: 631
Reputação: +371
Char no Tibia: Warrior of Mort

local config = {
local config = {
broadcast = {120, 30},
shallow = "no",
delay = 120,
events = 30
}
config.shallow = getBooleanFromString(config.shallow)
local function executeSave(seconds)
if(isInArray(config.broadcast, seconds)) then
local text = ""
if(not config.shallow) then
text = "[Auto Save]"
else
text = "O"
end
text = text .. " Serve irá salvar em " .. seconds .. " segundos, porfavor aguarde!"
doBroadcastMessage(text)
end
if(seconds > 0) then
addEvent(executeSave, config.events * 1000, seconds - config.events)
else
doSaveServer(config.shallow)
addEvent(doBroadcastMessage, 3000, "[Auto Save] Dados salvo com sucesso!")
end
end
function onThink(interval)
if(table.maxn(config.broadcast) == 0) then
doSaveServer(config.shallow)
addEvent(doBroadcastMessage, 3000, "[Auto Save] Dados salvo com sucesso!")
else
executeSave(config.delay)
end
return true
end
Esse /\ éh pra aparecer a msg e para salvar a cada 5 hras, altera no globalevents.xml:
<globalevent name="save" interval="18000" event="script" value="save.lua"/>
Editado Fevereiro 26 por Jhon992
Irei testar aqui, jaja edito.
EDIT
Funcionado perfeitamente, so que ele manda o [Auto Save] Dados salvo com sucesso! antes de da o save. É possível colocar apos o save?
Obrigado.
Editado Fevereiro 26 por Felipejf
info
Grupo: Conde
Registrado: 30/06/11
Posts: 631
Reputação: +371
Char no Tibia: Warrior of Mort

Editei ali em cima, vai mandar a msg após 3 segundos depois que o salve começa a ser executado, se quiser mais segundos troque o "3000" por +.




info
Grupo: Campones
Registrado: 14/12/07
Posts: 36
Reputação: +1
Utilizo esse serve save aqui:
local config = {
broadcast = {120, 30},
shallow = "no",
delay = 120,
events = 30
}
config.shallow = getBooleanFromString(config.shallow)
local function executeSave(seconds)
if(isInArray(config.broadcast, seconds)) then
local text = ""
if(not config.shallow) then
text = "[Auto Save]"
else
text = "O"
end
text = text .. " Serve irá salvar em " .. seconds .. " segundos, porfavor aguarde!"
doBroadcastMessage(text)
end
if(seconds > 0) then
addEvent(executeSave, config.events * 1000, seconds - config.events)
else
doSaveServer(config.shallow)
end
end
function onThink(interval)
if(table.maxn(config.broadcast) == 0) then
doSaveServer(config.shallow)
else
executeSave(config.delay)
end
return true
end
Queria duas coisa em mudar nele:
A primeira é colocar apos ele salvar os dados mandar uma mensagem escrito: [Auto Save] Dados salvo com sucesso!
E a segunda e colocar ele para salvar a cada 5 horas.
Editado Fevereiro 21 por Felipejf