itHyperoX Posted March 30, 2017 Posted March 30, 2017 (edited) 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 March 30, 2017 by TheMOG
NeXuS™ Posted March 30, 2017 Posted March 30, 2017 setTimer(function() outputChatBox("Down",root,255,255,255,true) end,tonumber(minutes)*60000,minutes)
NeXuS™ Posted March 30, 2017 Posted March 30, 2017 (edited) 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 March 30, 2017 by NeXuS™
itHyperoX Posted March 30, 2017 Author Posted March 30, 2017 hmm, now i dont get messages its down What you said before setTimer(function() outputChatBox("Down",root,255,255,255,true) end,tonumber(minutes)*60000,minutes)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now