ID:164901
 
Im just confused on how the keys work. Im reading a demo that shows admin keys but i have never seen anything where you input the key. Help would be apreciated.
Well a key is your byond key...

your key: FretFulGun
your ckey: fretfulgun

you could make a list of admins like...
var/list/Admins = list("FretFulGun","KirbyAllStar")
//and access them like...
if(src.key in Admins)
//Do something here!
//The src depends of course where you use this
//In something like Click() src and usr are different
//You should almost never use usr in procs
In response to KirbyAllStar
so i could do something like this?

var/list/admins = ("FretfulGun191")
if(src.key in Admins)
mob/verb/announce(msg as text)
world >> "[usr] <font color = "red"> ANNOUNCES [msg]!"

In response to FretFulGun
Well you could do something like this...

var/list/admins=list("FretFulGun")

mob/Admin/verb/announce(msg as text)
world << "[html_encode(usr.name)<font color = red>ANNOUNCES [html_encode(msg)]!"

mob/Login()
if(src.key in Admins)
src.verbs+=typesof(/mob/Admin/verb/)


The html_encode is to ensure that the user of the verb can't put dangerous html in the msg or in their name. I'm not sure how you have yours set up but you can change the usr.name to the usr.key if you need to. With this you also can have as many Admin verbs as you need just make sure they are under the "mob/Admin/verb/" path and add that in on your mob/Login or client/New().

Hope that helps...

-KirbyAllStar