Use Assim:
broadcast = {1},
shallow = "no",
delay = 1,
}
config.shallow = getBooleanFromString(config.shallow)
local function executeSave(seconds)
if(isInArray(config.broadcast, seconds)) then
local text = ""
if(not config.shallow) then
text = "O"
else
text = "S"
end
text = text .. " Server será salvo em " .. seconds .. " segundos, cuidado, poderá travar por alguns segundos!"
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






info
Grupo: Artesão
Registrado: 26/05/08
Posts: 142
Reputação: +9
Eu tenho esse "save.lua" no globalevents, ele avisa:
Eu queria que ele avisasse faltando 1 segundo para dar save, tipo uma mensagem assim:
Meu SAVE.LUA:
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 = "O"
else
text = "S"
end
text = text .. " Server será salvo em " .. seconds .. " segundos, cuidado, poderá travar por alguns segundos!"
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