ID:175503
 
Well I want to make it so Admins/Gms can hear anything and everything that anyone says. It is easy with some verbs (like world_say) because everyone is suppose to hear. The problem is with whispering naturally only one person is suppose to hear it. So how would I make it so admins/Gms can see the message as well.
This is the code I use for whispering.
Whisper(mob/M as mob in world,msg as message)
if (!M.key)
usr << "Thats a NPC!"
return
M << "[usr] whispers:\"[msg]\""
usr << "You whisper \"[msg]\" to [M]."

and all the admins are stored in a list (called Adminlist).
So any ideas?
How about:
Adminlist << "[usr] whispers:\"[msg]\" to [M]"

In response to Jon88
I've already tried that and it didn't work.
In response to Yuugi
There's no reason why it should'nt work if your list was created properly. It should either have src added to it if you're adding admins to it using a verb(ie Login), or should contain their keys when you define it.
In response to Jon88
This is what I'm using to define the admins keys and it works with everything else.
var/Adminlist = list("Yuugi")
In response to Yuugi
for(var/mob/M in world)
if(adminlist.Find(M))
M << "Stuff"
In response to Yuugi
Yuugi wrote:
This is what I'm using to define the admins keys and it works with everything else.
var/Adminlist = list("Yuugi")

The list needs to contain a reference to the mob of the admin not a key.

When you create your mob make sure and add it to the Adminlist not its key.
In response to Nadrew
That won't work either, Nadz, because it's still searching for mobs in the list. That has exactly the same effect as adminlist << "Stuff".
In response to Garthor
Why not just log it, then make the admins able to check the logs? This way, admins wouldn't get huge quantities of text lagging them down and making it impossible for them to play.
world.log << "Speech/[world.time]/[src] : [msg]/[M]"


I use the world log quite alot, for things like the automated payment system (in creds, of course). That way, I can check what happens without being in the game.
In response to Hazman
how would u make it so admins can check the log, wouldnt the log go on the hosts computer?
In response to Hazman
I don't get logs thats why I didn't use them. I can never find the file were something is logged to.
Were will the message be logged to?
Ahh I see now why the other's examples didn't work. If you do like Theodis said, you can do the Adminlist << "[msg]" or whatever, but if you want to keep it like you have it, do this:


//I will also show you how to make an easier to use whisper verb:

Whisper()
//Make a list of all the players in the world
var/list/L = list()
for(var/mob/M2 in world)
if(M2.client)
//Add the player to the list.
L += M2
var/mob/M = input("Who do you want to send a whisper to?","Whisper:") in L
var/msg = input("Type your message:","Message:") as text|null
if(msg == null||msg == "")
return
M << "[usr] whispers:\"[msg]\""
usr << "You whisper \"[msg]\" to [M]."

////////////Now for the To-All-GMs part:////////////

for(var/mob/GM in L)
if(Adminlist.Find(GM.key))
GM << "[usr] whispered:\"[msg]\" to [M]."
In response to Yuugi
The message (as far as I know) is logged to an internal game thing. If you wanted to retain the logs, you would have to store them in a savefile, but to simply view them, you would just
src << world.log
OK?
mob/verb/whisper(mob/m, t as text)
m<<"[usr] whispers [t] to you."
usr<<"You whisper [t] to [m]."
if(m.admin == 1)
m<<"[usr] whispers [t] to [m]."

I havent tested it, but it looks like its a go =P
In response to Demonskata630
That would do nothing except give two messages to people with an admin var of 1 if you send them a message.
In response to Kunark
Kunark wrote:
Ahh I see now why the other's examples didn't work. If you do like Theodis said, you can do the Adminlist << "[msg]" or whatever, but if you want to keep it like you have it, do this:


//I will also show you how to make an easier to use whisper verb:

Whisper()
//Make a list of all the players in the world
var/list/L = list()
for(var/mob/M2 in world)
if(M2.client)
//Add the player to the list.
L += M2
var/mob/M = input("Who do you want to send a whisper to?","Whisper:") in L
var/msg = input("Type your message:","Message:") as text|null
if(msg == null||msg == "")
return
M << "[usr] whispers:\"[msg]\""
usr << "You whisper \"[msg]\" to [M]."

////////////Now for the To-All-GMs part:////////////

for(var/mob/GM in L)
if(Adminlist.Find(GM.key))
GM << "[usr] whispered:\"[msg]\" to [M]."

Of course, that could be considerably shortened..
mob/verb/Whisper(mob/TargetMob, TheMessage as text)
for(var/mob/CheckMob in world)
if(CheckMob.client&&AdminList.Find(CheckMob.key))
CheckMob << "[src] whispers to [TargetMob], \"[TheMessage]\""
TargetMob << "[src] whispers to you, \"[TheMessage]\""
src << "You whisper to [TargetMob], \"[TheMessage]\""



~>Volte
In response to Volte
Thats the short way, but no one likes 200 mobs to pop up in the list when you want to whisper to someone "Hi, Fred!".