ID:262642
 
Code:
OOC_Player(msg as text)  // still testing this
set category = "GM"
set name = "Speak as Player"
for(var/mob/characters/M in world)
if(M.client)
world<<"<font color = white>--- <font color = blue>[M.oocname]<font color = white> ---<tt>><font color = red>[src]<font color = white><<font color = blue> Says to Everyone:<font color = white> [msg]"


Problem description:

i've been trying to code this but it keeps using my own name instead of the targeted mob.
i was just looking at ur code but i dont understand what ur trying 2 do can u axplain then ill help u ?
In the OOC_Player parameters, you can define two arguments. So, for example for what you're wanting..
OOC_Player(mob/characters/M in world,msg as text)   
set category="GM"
set name="Speak as Player"
if(M.client&&istype(M,/mob/characters)&&M!=usr) world<<"<font color = white>---</font><font color=blue>[M.oocname] says to everyone, </font><font color=white>\"[msg]\"</font>"


[Edit] Forgot an extra parenthesis on the if() statement, and also added in what Audeuro said.
OOC_Player(T as text) // still testing this
set category = "GM"
set name = "Speak as Player"
for(var/mob/characters/M in world)
if(M.client)
M << "[src.oocname]:[src]: [T]"
In response to Xeal
That would loop through all the players in the world and make each of them say the given message.
You used M.oocname, I think you mean src.oocname don't you?
In response to CIB
No need to use src in this kinda verb. And no, he wants to "speak for" another player, so he selects a player(M) and it shows their OOC name, then the given message(msg).
In response to Sinoflife
You might also want to make sure that the person you selected is NOT you. I've experienced this many times when testing verbs alone, that it'd pick me automatically and I didn't have measures to prevent it.
In response to Audeuro
Audeuro wrote:
You might also want to make sure that the person you selected is NOT you. I've experienced this many times when testing verbs alone, that it'd pick me automatically and I didn't have measures to prevent it.

i think thats what was happening and thank you for all your help i'm gonna try putting it to good use.. kinda >=D
In response to Zaber_Fang
Also, with your HTML..By the standards of LummoxJR and probably others, you shouldn't have any spaces between a variable, the assignment operator, and the value.

Example:

<font color=Red></font>


Is correct, rather then:

<font color = Red> </font>

If you're trying to speak through another player, your doing it completely wrong.

OOC_Player(mob/M in world,msg as text)//choose the player and type the text
set category = "GM"
set name = "Speak as Player"
world<<"<font color = white>--- <font color = blue>[M.oocname]<font color = white> ---<tt>><font color = red>[M.name]<font color = white><<font color = blue> Says to Everyone:<font color = white> [msg]"




In response to Karrigo
both codings say i need , or paren ).. 6 errors in one line
In response to Zaber_Fang
Because I made that to show you how to do it, not for you to copy and paste.
In response to Karrigo
Ok, honestly, Karrigo, I wonder why you pretty much restated what I said without the needed checks and changing mob/characters/M to mob/M so he can choose enemies or NPCs which probably don't have the OOCname variable.