ID:178868
 
i know ive seen this thread somewhere b4, but i cant find it, so could someone help me out with a mute command?
mob/var/mute=0

mob/Gm/verb/Mute(mob/M as mob in world)
M.mute=1
mob/Gm/verb/Unmute(mob/M as mob in world)
M.mute=0

mob/verb/Say(T as text)
if(usr.mute==1)
return
else
world<<"[usr]: [T]"
In response to Super16
thanks
Or

mob
var
muted = 0
mob/verb/Mute(mob/M in world)
if(M.muted>= 0)
M.muted = 1
M <<"You have been muted by [usr]!"
usr <<"You have muted [M]!"
else
usr <<"[M] is already muted!"
mob/verb/Un_Mute(mob/M in world)
if(M.muted>= 1)
M.muted = 0
M <<"You have been un-muted by [usr]!"
usr <<"You have un-muted [M]!"
else
usr <<"[M] is not muted!"
mob/verb/Say(msg as text)
if(usr.muted>= 1)
usr <<"You are muted!"
else
world <<"[usr]: [msg]"

Thats also good.

-Kappa the Imp



Here's a more simple one than the other two posted:

mob
var
muted = 0

mob/GM/verb/Mute(mob/M as mob in world)
if(M.muted)
usr << "You unmute [M]."
M.muted = 0
else
usr << "You mute [M]."
M.muted = 1

mob/verb/Say(T as text)
if(usr.muted)
usr << "You cannot speak because you're muted."
else
world << "[usr]: [html_encode(copytext(T,1,250))]"
In response to Kappa the Imp
Kappa the Imp wrote:
if(usr.muted>= 1)

Bad programming practice; it's slightly better than Super16's version which uses ==1, but it's not good. You should be comparing this to 0, since all you're really interested in is a simple true/false value. BYOND handles true/false values by saying if it's not 0, it's true. So it's better to get in line with DM's system:
if(usr.muted)

Lummox JR