ID:145828
 
Code:
mob
Stat()
statpanel("Banned")
stat(banned)
verb
Ban(t as text)
if(!locate(ckey(t))in banned)
banned.Add(ckey(t))
src<<"<strong>[ckey(t)] was banned.</strong>"
UnBan()
if(banned.len>0)
var/k=input("Who do you want to unban?")as null|anything in banned
if(k&&k in banned)
banned.Remove(k)
src<<"<strong>[k] was unbanned.</strong>"
else src<<"<strong>There is currently noone banned.</strong>"
var/list/banned=list()


// So, any ideas why it'll add the same
// text multiple times to the banned list
// if I use the verb multiple times?


The use of locate() isn't useful if you just want to check if text is in a list. Something like this would work:

if(!(ckey(t) in banned))
...


~~> Unknown Person
In response to Unknown Person
I initially did that, and it doesn't do anything at all if done that way.
I've tried;
// [X]=Did not even work.
if(!(ckey(t)) in banned)) [X]
if(!("[ckey(t)]") in banned)) [X]
if(!ckey(t) in banned) [X]
if(!"[ckey(t)]" in banned) [X]
if(!locate(ckey(t)) in banned)
if(!locate("[ckey(t)]") in banned)

And other things.
In response to Artemio
Fixed it using
!(ckey(t) in banned)
In response to Artemio
UP said that >.>


If you want to know why, it is because in is low in the order of operations.
In response to Kalzar
I know. I was PRETTY sure I had used that before, though, so I doubted it would work. But, I'm tired, so I forget.