ID:272672
 
I currently have a macro that works only for Admins. What it does is pop up a box with all the admin procs in it.

I wonder if there is a better way of doing that than this, which I find quite messy ;

mob/verb/AdminVerbs()

if(!GMlevel) return // if he's not a GM, return.

var/list/toggle=list("Admin Chat","Ban","Unban","Mute","Unmute","Boot") // enforcer procs

if(GMlevel>1) toggle += list("Announce","Teleport","Summon","Rename") // if he's a moderator, add the moderator procs.

if(GMlevel>2) toggle += list("Shutdown","Reboot","World Mute","World Unmute") // lastly, admin procs.

var/L = input("Admin Verbs","Naruto Online") in toggle

switch(L)

if("Admin Chat") Admin_chat()
if("Ban") Ban()
if("Unban") Unban()
if("Mute") Mute()
if("Unmute") Unmute()
if("Boot") Boot()
if("Announce") Announce()
if("Teleport") Teleport()
if("Summon") Summon()
if("Rename") Rename()
if("Shutdown") Shutdown()
if("Reboot") Reboot()
if("World Mute") World_mute()
if("World Unmute") World_unmute()
text2path() can be useful to call() the procs.

Under the verb declaration, put set name=".AdminVerbs" and/or set hidden=1, hiding the verb completely.


In response to Kaiochao
I tried using call but it didn't work.

I will, but there is no need. Besides not having any statpanel on my game. If people try to use it they'll be barred by the if(!GMlevel) check.
In response to Andre-g1
call(text2path("/mob/proc/[L]")) should work, all except for the ones with a space(" ") in L, which would need to be replaced with "_" or just take the _ out of the proc declaration.
In response to Kaiochao
Okay, it worked, with a few changes, but nonetheless it helped clearing a big portion of the code. Thanks !