Jump to content

Restart timer


Miika

Recommended Posts

My script not working, there is problem:

WANRNING: restart/restart.lua:9: Bad argument @ 'addCommandHandler' [Expected function argument, 2 got nil] 

[server]

function restartCommand(source, command) 
    if (isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin"))) then 
        outputChatBox("00FF00[server]FF0000 Restart 10min kuluttua!",getRootElement(),255,0,255,true) 
        setTimer ( step2, 300000, 1) 
    else 
        outputChatBox("You don't have permission to restart server!",source,255,0,0) 
        return end 
end 
addCommandHandler("Restartti", getRootElement(), restartCommand) 
  
function step2() 
    outputChatBox("00FF00[server]FF0000 Restart 5min kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step3, 240000, 1) 
end 
  
function step3() 
    outputChatBox("00FF00[server]FF0000 Restart 1min kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step4, 30000, 1) 
end 
  
function step4() 
    outputChatBox("00FF00[server]FF0000 Restart 30sec kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step5, 20000, 1) 
end 
  
function step5() 
    outputChatBox("00FF00[server]FF0000 Restart 10sec kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step6, 5000, 1) 
end 
  
function step6() 
    outputChatBox("00FF00[server]FF0000 Restart 5sec kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step7, 5000, 1) 
end 
  
function step7() 
    outputChatBox("00FF00[server]FF0000 Restart NYT!",getRootElement(),255,0,255,true) 
    shutdown (reason or "Restart") 
end 

Link to comment
function restartCommand(source, command) 
    if (isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin"))) then 
        outputChatBox("00FF00[server]FF0000 Restart 10min kuluttua!",getRootElement(),255,0,255,true) 
        setTimer ( step2, 300000, 1) 
    else 
        outputChatBox("You don't have permission to restart server!",source,255,0,0) 
        return end 
end 
addCommandHandler("Restartti", restartCommand) 
  
function step2() 
    outputChatBox("00FF00[server]FF0000 Restart 5min kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step3, 240000, 1) 
end 
  
function step3() 
    outputChatBox("00FF00[server]FF0000 Restart 1min kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step4, 30000, 1) 
end 
  
function step4() 
    outputChatBox("00FF00[server]FF0000 Restart 30sec kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step5, 20000, 1) 
end 
  
function step5() 
    outputChatBox("00FF00[server]FF0000 Restart 10sec kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step6, 5000, 1) 
end 
  
function step6() 
    outputChatBox("00FF00[server]FF0000 Restart 5sec kuluttua!",getRootElement(),255,0,255,true) 
    setTimer ( step7, 5000, 1) 
end 
  
function step7() 
    outputChatBox("00FF00[server]FF0000 Restart NYT!",getRootElement(),255,0,255,true) 
    shutdown (reason or "Restart") 
end 

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...