ID:268799
 
i want to make a code where players can ignor a person thats bothering them and you cant see there msgs so like ignor and unignor heres my OOC how would i do this?

mob
verb
OOC(msg as text)
set hidden = 1
if(!msg&&length(msg)>250||findtext("[msg]","<"))
return
else
world <<"<b><font size = 1><font color = red>([usr.oocname])[usr] OOC's: <font color = white>[Safe_Guard(msg)]"
Let every mob or client have a list called Ignored or somthing. Then just search through the list and if it finds their key name or character name (or whatever you store in it) the message won't go to them. Use a for loop.
In response to Wanabe
?
In response to Dranzer_Solo
mob/var/list/Ignored= new()
mob/verb
Ignore(mob/M as mob in world)
if(!M.client){return} //Don't want to ignore NPCs.\
They do not talk anyways!

usr.Ignored.Add(M.ckey) //Add M's ckey.
M<< "[usr] has ignored you."

UnIgnore()
if(!usr.Ignored.len){return}
var/Name= input("Un-ignore whom?","Un-Ignore","Cancel") in usr.Ignored
usr.Ignored.Remove(Name)
for(var/mob/M in world)
if(M.ckey!=Name){continue}
M<< "[usr] has un-ignored you."

OOC(msg as text)
set hidden = 1
if(!msg&&length(msg)>250||findtext("[msg]","<")){return}
for(var/mob/M in world)
if(!M.client){continue} //Skip this NPC
if(usr.Ignored.Find(M.ckey)){continue} //Skip this person
M <<"<b><font size = 1><font color = red>([usr.oocname])[usr] OOC's: <font color = white>[Safe_Guard(msg)]"

I did not test this, but it should work.

There is a mob variable- Ignored, which is a list.
It contains the ckey of people he wants to ignore. (ckey = key lowercase without spaces)

The Ignore verb will add the ckey of a mob to the list. (The mob is one you select from a input window that appears)

The Un-Ignore verb will remove a ckey from the list.

The OOC verb now works as follows:
for(var/mob/M in world)
//For all of the mobs in the world (The current hosted world)
if(!M.client){continue}
// If M is not an actual player, continue (skip it, move to next mob)
if(usr.Ignored.Find(M.ckey)){continue}
// If M's ckey is in your Ignored list, skip it, move to the next mob)
M <<"<b><font size = 1><font color = red>([usr.oocname])[usr] OOC's: <font color = white>[Safe_Guard(msg)]"
// This will send the message to M, but if M is not a client or M is \
Ignored by usr, then he will not recieve the message.



In response to JackGuy
ok thanks i understand that