SO
pedido

Server Save

Por soldoran, 08 de out. de 2012 em Scripts

script
15
2.4k
soldoranS
08 de outubro de 2012 às 13:21

Ola galera,venho pedir algo bem simples pra quem entende do assunto..

 

é sobre o save do server

 

queria que uns 2 segundos antes de salvar,manda-se uma msg avisando tipo [server Salvando]

 

ai depois do save,mandava a msg de [server Salvo]

 

Script 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 = "Full s"
else
text = "S"
end

text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!"
doBroadcastMessage(text)
end

if(seconds > 0) then
addEvent(executeSave, config.events * 1000, seconds - config.events)
else
doSaveServer(config.shallow)
end
end

function onThink(interval, lastExecution, thinkInterval)
if(table.maxn(config.broadcast) == 0) then
doSaveServer(config.shallow)
else
executeSave(config.delay)
end

return true
end

Editado Outubro 8 por soldoran

Yan OliveiraY
09 de outubro de 2012 às 23:37

Veja se é o que vc quer:

 

 

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 = "Full s"

else

text = "S"

end

 

text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!" onThink(interval, lastExecution, thinkInterval) doBroadcastMessage("Game save within XXXX seconds!")

doBroadcastMessage(text)

end

 

if(seconds > 0) then

addEvent(executeSave, config.events * 1000, seconds - config.events)

else

doSaveServer(config.shallow)

end

end

 

function onThink(interval, lastExecution, thinkInterval)

if(table.maxn(config.broadcast) == 0) then

doSaveServer(config.shallow)

else

executeSave(config.delay)

end

 

return true

end

 

 

 

Ae em XXXX vc coloca o tempo q vai salvar.

 

Se não funcionar me avisa.

Editado Outubro 9 por Yan18

soldoranS
10 de outubro de 2012 às 11:16

pelo que pareçe não

 

porque era mais tipo um aviso que ia travar..

ai colocava pra 2 segundos antes do salve,ai quando todos estivese vendo depois de 2 segundos ja salva e depois de salvo..a msg de server salvo

Yan OliveiraY
10 de outubro de 2012 às 14:36

Não entendi amigo, explique denovo.

KennyConradK
10 de outubro de 2012 às 20:34

aki está

 

 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 = "{"
end

text = text .. " Radbr Server vai salvar dados em  " .. seconds .. " segundos, na hora do save o serve pode 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, lastExecution, thinkInterval)
if(table.maxn(config.broadcast) == 0) then
doSaveServer(config.shallow)
else
executeSave(config.delay)
end

return true
end

 

te ajude REP +

soldoranS
10 de outubro de 2012 às 22:05

entao fico bom...

mas falto

tipo 1 segundo antes de salvar

apareçer a msg

 

Salvando.......

 

e depois que salvar..apareçer

 

Server Salvo!

 

 

valeu pela ajuda yan mas é mais ou menos oq ele fez..

 

so falto oq eu falei acima

Editado Outubro 10 por soldoran

Yan OliveiraY
10 de outubro de 2012 às 23:00

Ve se é assim q vc quer:

 

 

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 = "{"

end

 

addEvent(doBroadcastMessage, 300000, "O server será salvo, podera dar uma travada Galera!\n!")

doBroadcastMessage(text)

end

 

if(seconds > 0) then

addEvent(executeSave, config.events * 5000, seconds - config.events)

else

doSaveServer(config.shallow)

end

end

 

function onThink(interval, lastExecution, thinkInterval)

if(table.maxn(config.broadcast) == 0) then

doSaveServer(config.shallow)

else

executeSave(config.delay)

end

 

return true

end

 

se não funcionar me avise.

Editado Outubro 11 por Yan18

soldoranS
10 de outubro de 2012 às 23:50

funcionar funciona

mas nao to querendo muda o tempo das msg

e sim adcionar novas msg...foi oq ti falei no privado

 

mas valeu pela ajuda

Yan OliveiraY
11 de outubro de 2012 às 12:20

Veja se funciona assim:

 

 

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 = "{"

end

 

addEvent(doBroadcastMessage, 300000, "O server será salvo, poderá dar uma travada Galera!\n!")

doBroadcastMessage(text)

end

 

if(seconds > 20) then

addEvent(executeBroadcastMessage, config.events * 200, seconds - config.events)

else

doSaveServer(config.delay)

end

 

if(seconds > 0) then

addEvent(executeSave, config.events * 5000, seconds - config.events)

else

doSaveServer(config.shallow)

end

end

 

function onThink(interval, lastExecution, thinkInterval)

if(table.maxn(config.broadcast) == 0) then

doSaveServer(config.shallow)

else

executeSave(config.delay)

end

 

return true

end

 

Se n funcionar me avise.

Editado Outubro 11 por Yan18

KennyConradK
11 de outubro de 2012 às 14:43

Yan 18 ele quer tipo assim olha

 

 function executeClean()
doCleanMap()
doBroadcastMessage("[ AutoClean RadBR ] Limpando itens do chão...")
doBroadcastMessage("[ AutoClean RadBR ] Itens limpos com sucesso!")
return true
end

function onThink(interval, lastExecution, thinkInterval)
doBroadcastMessage("[ AutoClean RadBR ]: Atenção! Server vai limpar os itens do chão em 1 minuto! Caso tenha itens no chão, pegue-os imediatamente!")
addEvent(executeClean, 60000)
return true
end

 

so que essa ai é clean ele quer que fale as mesmas mensagens saca porem com o save

Yan OliveiraY
11 de outubro de 2012 às 17:02

Yan 18 ele quer tipo assim olha

 

 function executeClean()
doCleanMap()
doBroadcastMessage("[ AutoClean RadBR ] Limpando itens do chão...")
doBroadcastMessage("[ AutoClean RadBR ] Itens limpos com sucesso!")
return true
end

function onThink(interval, lastExecution, thinkInterval)
doBroadcastMessage("[ AutoClean RadBR ]: Atenção! Server vai limpar os itens do chão em 1 minuto! Caso tenha itens no chão, pegue-os imediatamente!")
addEvent(executeClean, 60000)
return true
end

 

so que essa ai é clean ele quer que fale as mesmas mensagens saca porem com o save

 

Mas seu script ta com função Clean ele quer Save.

soldoranS
11 de outubro de 2012 às 19:45

Quero tipo do Kenny

mas com clean...kenny so deu um exemplo

SkymagnumS
11 de outubro de 2012 às 20:21
local function salveServer()
doSaveServer()
broadcastMessage("[AUTO MESSAGE]: Servidor salvo, próximo daqui 2 horas.", 22)
end


function onThink(interval, lastExecution, thinkInterval)
addEvent(salveServer, 5 * 1000)
broadcastMessage("[AUTO MESSAGE]: Servidor irá salvar daqui 5 segundos vá para algum local seguro.", 22)
return true
[indent=1]end

[/indent]

soldoranS
11 de outubro de 2012 às 20:49

obrigado

Skymagnum

 

 

rep+

caoticC
12 de outubro de 2012 às 08:42

O pedido foi atendido.

Tópico Movido