[PM] Improving private messaging on darkrp gamemode!

Help me please to realize my idea.
I whant to change this code:


local function PM(ply, args)    local namepos = string.find(args, " ")
    if not namepos then return "" end


    local name = string.sub(args, 1, namepos - 1)
    local msg = string.sub(args, namepos + 1)
    if msg == "" then return "" end
    target = FindPlayer(name)


    if target then
        local col = team.GetColor(ply:Team())
        TalkToPerson(target, col, "[Private Message] from "..ply:Nick(),Color(255,0,0,255), msg, ply)
        TalkToPerson(ply, col, "[Private Message] to "..ply:Nick(), Color(0,255,0,255), msg, ply)
    else
        Notify(ply, 1, 4, string.format(LANGUAGE.could_not_find, "player: "..tostring(name)))
    end


    return ""
end
AddChatCommand("/pm", PM)

I want this to make a sound when message come or send.
I tried to make it myself but i failed.
Please help me.

[lua]if target then
ply:EmitSound(“cow/horse.wav”, 300, 100)
local col = team.GetColor(ply:Team())
TalkToPerson(target, col, "[Private Message] from "…ply:Nick(),Color(255,0,0,255), msg, ply)
TalkToPerson(ply, col, "[Private Message] to "…ply:Nick(), Color(0,255,0,255), msg, ply)
else
[/lua]

Thanks you a lot!

I will realize it on garrysmod.org

Heres A hint: Don’t upload this stuff to garrysmod.org without RetTurtl3’s consent. People get mad sometimes when you do this

I Don’t mind :stuck_out_tongue: people do it anyway nothing is going to stop them.

[editline]14th January 2012[/editline]

They’re just showing me love. <3

I remember his help, and I don’t forget about it.
I will add his name for example:

Idea: lua_error
Code: RetTurtl3

And I still working on my idea to improve Private Messaging.