• Evolve Shutdown Script not working
    5 replies, posted
Hey. I have created a server shutdown plugin for Evolve. I want it to post a countdown to the chat, but it doesn't work. Most probably I'm missing something obvious here. [EDIT: old link removed] Edit: I got it working, problem solved.
You should post how you fixed it so others with this problem will also be able to fix it.
Ask Over:v: it's his Admin mod plugin
Uhm, I looked it over, this should work. [lua] local PLUGIN = {} PLUGIN.Title = "Server Shutdown" PLUGIN.Description = "Shuts the server down after 30 seconds." PLUGIN.Author = "PotcFdk" PLUGIN.ChatCommand = "shutdown" PLUGIN.Usage = "" PLUGIN.Privileges = { "Server shutdown" } function PLUGIN:Call( plyer, args ) if ( plyer:EV_HasPrivilege( "Server shutdown" ) ) then local tick = 30; evolve:Notify( evolve.colors.blue, plyer:Nick(), evolve.colors.white, " has triggered the automatic server shutdown.") timer.Create("svsd1", 1,0, function() if (tick > 0) then if (tick == 30) or (tick == 20) or (tick == 10) then evolve:Notify( evolve.colors.white, "Server shutdown in "..tick.." seconds.") elseif (tick < 5) then evolve:Notify( evolve.colors.red, "!! SERVER SHUTTING DOWN !!" ) end tick = tick - 1; else RunConsoleCommand("killserver") end end) else evolve:Notify( plyer, evolve.colors.red, evolve.constants.notallowed ) end end evolve:RegisterPlugin( PLUGIN ) [/lua]
Here is how I solved it... [crap code removed]
You don't need to continuously create timers, it's not necessary. My way is much more clean, so it's easier to read and if you wanted to make it so that mine streams the server shutdown time just remove the if (tick == 30) or (tick == 20) or (tick == 10) then statement. I'll edit my code so that it'll notify red when the server is about to shutdown, for you.
Sorry, you need to Log In to post a reply to this thread.