Jump to content

serverShutdown


itHyperoX

Recommended Posts

Hi, i'm working on servershutdown command, its working but i dont know how to make that, the messages show on the chat every minutes.

Like: /servershutdown 5 Test

After 1 minutes it put out the chat:

The server is going down in about 4 minutes

after 1 minutes

The server is going down in about 3 minutes

after 1 minutes

The server is going down in about 2minutes

after 1 minutes

The server is going down in about 1 minutes

after 1 minutes

server is goind down

function shutdown(player,cmd,minutes,...)
local reason = table.concat({ ... }, " ") 
local minutes = tonumber(minutes)
if #reason > 0 then
outputChatBox("The server is going down in about "..minutes.." minutes.",root)
outputChatBox(reason,root)
setTimer(function()
    outputChatBox("Down",root,255,255,255,true)        
end,tonumber(minutes)*60000,1)
end

end
addCommandHandler("servershutdown",shutdown)

 

Edited by TheMOG
Link to comment
local restMinutes = 0
function shutdownCmd(player,cmd,minutes,...)
	local reason = table.concat({ ... }, " ") 
	local minutes = tonumber(minutes)
	restMinutes = minutes
	if #reason > 0 then
		outputChatBox("The server is going down in about "..minutes.." minutes.",root)
		outputChatBox(reason,root)
		setTimer(function()
			restMinutes = restMinutes - 1
			outputChatBox("The server is shutting down in " .. restMinutes .. " minutes.",root,255,255,255,true)        
		end, 60000, minutes)
		setTimer(shutdown, 60000*minutes, 1, reason)
	end
end
addCommandHandler("servershutdown",shutdownCmd)

 

Edited by NeXuS™
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...