ID:1515029
 
(See the best response by JEY_SENSEY.)
Code:
IM(mob/Player/M in world,msg as text)
set name = "Instant Message"
if(M.IMtoggle)
usr<<"<font color = yellow><b>Chat Info:</font> This user has blocked IM."
return
else
if(lentext(Text) > 120){src << "<font color = yellow><b>Game Info: </font>Your message is too long."; return}
else
M<<"<i><font size=2><font color=yellow><b>[usr] Received IM: [msg]"
usr<<"<i><font size=2><font color=yellow><b>[M] Sent IM: [msg]"


Problem description:

How do you exclude NPC characters from appearing in the list?

How to specify the verbs to Players, so their names only appears on the list?
Have your NPCS be its own type of mob and not a Player.
You're on the right track. you specified that only those of type /mob/Player would be passed as an argument. Another way would be to use each client connected to the world.
Unfortunately, you can't specify types in the verb arguments itself... At least, as far as I remember. I haven't used verbs in a long, long time, though.

var
list/players = list()

mob/player
Login()
. = ..()
//make sure the player's name can't change!
players[src.name] = src

Logout()
players.Remove(src.name)
. = ..()
proc
tell()
set name = "Instant Message"
var/ply
var/msg
if(args.len)
ply = args[1]
msg = args[2]
if(ply==src.name)
src << "You can't IM yourself."
return
var/list/l = players.Copy(1,0)
l.Remove(src)
if(!ply)
ply = input(src,"Who would you like to send a message to?","IM") as text|null in players
if(!ply)
return
ply = players[ply]
else
ply = players[ply]
if(!ply)
src << "The player was not found!"
return
if(!msg)
msg = input(src,"Message","IM") as text|null
if(!msg||length(msg)==0)
return
var/mob/player/p = ply
if(p.IMtoggle)
src << "The player has disabled IMs."
return
src << "to [p.name]: [msg]"
p << "from [src.name]: [msg]"


You might have to use generic arguments and do the input handling yourself.

I'm not sure about this one, though:

tell(ply as text|null|anything in players,msg as text)


^The above might work.
Best response
use one list() in code specifying that only see users:

        IM()
set name = "Instant Message"
var/list/players = list()
for(var/mob/M in world)
if(M.client) players += M
if(M == usr) players-=M
var/mob/M = input("Who do you want to Send a Message?","IM")as null|anything in players
if(!M) return
var/msg = input("¿You want to tell [M] ([M.key])?","IM") as text|null
if(!msg) return
if(M.IMtoggle)
usr<<"<font color = yellow><b>Chat Info:</font> This user has blocked IM."
return
usr<<"(MP)</font color><font color=blue><--- to:[M]</a>:</font color> <font size=1><font color=yellow><b><i>[html_encode(msg)]")
M<<"(MP)</font color><font color=blue>---> of: [usr]</a>:</font color> <font size=1><font color=yellow><b><i>[html_encode(msg)]")
In response to JEY_SENSEY
JEY_SENSEY wrote:
use one list() in code specifying that only see users:

>       IM()
> set name = "Instant Message"
> var/list/players = list()
> for(var/mob/M in world)
> if(M.client && M.PM&&!M.DesOnline) players += M
> if(M == usr) players-=M
> var/mob/M = input("Who do you want to Send a Message?","IM")as null|anything in players
> if(!M) return
> var/msg = input("¿You want to tell [M] ([M.key])?","IM") as text|null
> if(!msg) return
> if(M.IMtoggle)
> usr<<"<font color = yellow><b>Chat Info:</font> This user has blocked IM."
> return
> usr<<"(MP)</font color><font color=blue><--- to:[M]</a>:</font color> <font size=1><font color=yellow><b><i>[html_encode(msg)]")
> M<<"(MP)</font color><font color=blue>---> of: [usr]</a>:</font color> <font size=1><font color=yellow><b><i>[html_encode(msg)]")
>
>


You should not be looping through every mob in the world every time you want to send a PM. This entire snippet is horribly inefficient.
Thanks for the help guys! Didn't exactly use the codes above, but that list var helped.
In response to Mitz001
Mitz001 wrote:
Thanks for the help guys! Didn't exactly use the codes above, but that list var helped.

Just a side note, always close your tags in the same statement. If you push something out that doesn't have tags around it, then it'll take the tags of the last sent message and cause a really bad looking chat system. Also, you can combine multiple font properties:
<font color='yellow' size='10'></font>
Will do, tyvm.