Ir para conteúdo

Featured Replies

Postado

Cara oque eu estou te passando não é globalevents é talkactions,pensei que você queria o script de /save..

Globalevents tenta esse :

local shutdownAtServerSave = false
local cleanMapAtServerSave = false

local function serverSave()
        if shutdownAtServerSave then
                Game.setGameState(GAME_STATE_SHUTDOWN)
	else
		Game.setGameState(GAME_STATE_NORMAL)
        end
        if cleanMapAtServerSave then
                cleanMap()
        end
        saveServer()
end

local function secondServerSaveWarning()
        broadcastMessage("Server is saving game in one minute. Please go to a safe place.", MESSAGE_STATUS_WARNING)
        addEvent(serverSave, 60000)
end

local function firstServerSaveWarning()
        broadcastMessage("Server is saving game in 3 minutes. Please go to a safe place.", MESSAGE_STATUS_WARNING)
        addEvent(secondServerSaveWarning, 120000)
end

function onTime(interval)
        broadcastMessage("Server is saving game in 5 minutes. Please go to a safe place.", MESSAGE_STATUS_WARNING)
        Game.setGameState(GAME_STATE_STARTUP)
        addEvent(firstServerSaveWarning, 120000)
        return not shutdownAtServerSave
end

Use está tag :

<globalevent name="Server Save" time="09:55:00" script="serversave.lua"/>
  • Respostas 19
  • Visualizações 4.2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Tenta esse : local savingEvent = 0 function onSay(cid, words, param, channel) local tmp = tonumber(param) if(tmp ~= nil) then stopEvent(savingEvent) save(tmp * 60 * 1000) elseif(param:trim()

Postado
  • Autor

sim amigo é global event, o problema desse script ai é que leva  muito tempo pra salvar eu quero que salve a cada 5 minutos, esse save é o global save............... imagine se o server fica 3 hora online os cara upando e derrepente crashhhhhhhh nessa versão tfs ta ruim de mais instavel............. por isso quero que salve a cada 5 minutos

Postado

Entendi..
Tenta usar este então :

local config = {
	broadcast = {},
	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 = ""
		else
			text = ""
		end

		text = text .. "" .. 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)
	if(table.maxn(config.broadcast) == 0) then
		doSaveServer(config.shallow)
	else
		executeSave(config.delay)
	end

	return true
end

 

Postado

<globalevent name="save" interval="10000" event="script" value="save.lua"/>

 

local config = {
broadcast = "yes"
}
 
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("Full server save within " .. seconds .. " seconds, please stay in safe place!")
end
 
seconds = seconds - 30
if(seconds >= 0) then
addEvent(executeSave, 30 * 1000, seconds)
end
end
 
function onThink(interval, lastExecution, thinkInterval)
if(not config.broadcast) then
doSaveServer()
return true
end
 
executeSave(120)
return true
end

16s5uc.gif2moe247.gif  swvimf.gif 

 

 

 

raell, me come

 

 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo