ID:164295
 
I want to make a shutdown verb but i want to make it so that they can choose how long and if they want to interupt the shutdown at any time.. Can someone help me with that one?
mob
verb
Shut_Down()
switch(alert("Are you sure?","Shut Down","Yes","No"))
if("Yes")
world << "<center><b>WORLD IS SHUTTING DOWN IN 5 SECONDS..."
sleep(50)
del(world)


This is what I use but it doesnt have all the other stuff you mentioned
In response to Monkeykid0049
then it isn't helping me is it.. i wanted that specific verb >.>

Monkeykid0049 wrote:
> mob
> verb
> Shut_Down()
> switch(alert("Are you sure?","Shut Down","Yes","No"))
> if("Yes")
> world << "<center><b>WORLD IS SHUTTING DOWN IN 5 SECONDS..."
> sleep(50)
> del(world)
>

This is what I use but it doesnt have all the other stuff you mentioned
In response to Robertg0123
as in a verb only an admin/gm could use?
In response to Monkeykid0049
yea
In response to Robertg0123
Robertg0123 wrote:
then it isn't helping me is it.. i wanted that specific verb >.>

Ouch. Why not say thanks for the help he attempted to offer? It should at least give you an idea.

I could sit here and write code you want, but from that attitude I don't think I'll waste my time.
In response to Rockinawsome
Ok so I was a little harsh.. I am playing a game and people are pissing me off.. So to you and Monkeykid0049 I apologize..
In response to Robertg0123
mob
var
ShutDown = 0


mob
Admin
verb
ShutDown()
set category = "Admin"
if(usr.ShutDown==0)
switch(alert("Are you sure?","Shut Down","Yes","No"))
if("Yes")
world << "<center><b>WORLD IS SHUTTING DOWN IN 5 SECONDS..."
ShutDown = 1
sleep(50)
del(world)
if(usr.ShutDown==1)
ShutDown = 0
world << "Shut down has been cancelled"
return

Well this kind of works. The only problem is i dont know how to make it stop the shutdown. Even though it says it stops it it doesnt. That part youll have to figure out yourself. It makes it so its placed under the Admin category and to make it so only certain people can use it you would put in:
mob
Login()
if(usr.key=="Crasianboy")//Replace my key with yours
usr.verbs += typesof(/mob/Admin/verb/)


In response to Monkeykid0049
Well thank you.. But can you add a custom amount of time in it. Like ()Seconds.. you can choose how long it takes to shut down... and if you can remove the cancel part if it doesn't work.. Thanks for trying :)
In response to Monkeykid0049
var/shutdown = 0

proc/shutdown(var/time)
shutdown = 1
spawn(time)
if(shutdown) del(world)

admin/verb/Shutdown()
if(shutdown) shutdown = 0
else
var/t = input() as num
shutdown(t)
In response to Garthor
it didn't work.. ty for trying but i got a bunch of errors..

This is my error

runtime error: bad client
proc name: Shutdown2 (/mob/Owner/verb/Shutdown2)
usr: Agent 007 (/mob/characters/Normal_Chao)
src: Agent 007 (/mob/characters/Normal_Chao)
call stack:
Agent 007 (/mob/characters/Normal_Chao): Shutdown2()
In response to Robertg0123
I GOT IT!!!!!!!! YAAY

Heres the Variables
var
sdt = 0
sdt2 = 0
shuttingdown = 0


Heres the Verb
mob
verb
Shutdown()
set category = "Game Master"
set name = "Shutdown World"
if(shuttingdown == 1)
switch(alert(usr,"Do you wish to Cancel Shut Down","Shut Down","Yes","No"))
if("Yes")
world << "[usr] Canceled Shut Down"
shuttingdown = 0
if("No")
return
else if(shuttingdown == 0)
sdt = input("How Many Seconds Until Shutdown.","Shut Down",sdt)
world << "Server shutting down in [sdt] seconds."
shuttingdown = 1
sdt2 = sdt*10
sleep(sdt2)
if(shuttingdown == 0)
return
else
del(world)


IT WORKS!!! YAAY
In response to Robertg0123
Argh, that's somewhat horribl...

Tips for learning:

- Instead of specifically looking for 1 or 0, use the boolean method which you can learn about here

- After learning about boolean, you can join all those variables in to one, when you cancel something, set the value to a negative value and speficially check for it if it is cancelled.

BTW, std2 is useless, you can get the same effect by doing either sleep(std*10) or std*=10 as you don't need to use std after that one simple message.