Okay, I can add someones name to the mute list, but it won't let me remove them. I'm using names instead of the mob itself so that re-logging won't undo the mute.
When I attempt to unmute, i get the error:
runtime error: type mismatch: "Larduck" -= "Larduck"
Can anyone help me out with this?
Code:
mob
verb
mute()
//set hidden = 1
var/list/choose=new/list()
for(var/mob/m in world)
if(m.key/*&&m.key!=key*/)
if(m.name in list(mutelist))
choose+="[m.name] (Unmute)"
else
choose+="[m.name]"
choose+="Cancel"
if(choose.len<2)
src << "There are no players you can mute"
return
var/mute=input("Who would you like to mute / unmute?","Mute / Unmute","Cancel") in choose
if(mute=="Cancel")
return
else
for(var/mob/m in world)
if(m.key)
if(mute=="[m.name] (Unmute)")
mutelist-="[m.name]"
src << "Unmuted [mute]"
if(mute=="[m.name]")
src << "Muted [mute]"
mutelist+="[mute]"
There are also a few tips I can give you. From your code snippet I notice that you're adding names to the list of muted players instead of keys. This would allow me to bypass the mute simply by recreating my character.
AFAIK you can also use an associative list to find the value you want instead of manually looking up players.
Your approach also doesn't allow you to remove players from the list once their mob goes away (i.e., they logged out, since a lot of games delete mobs when players log out).
You might want to try an approach like this one: