Got it almost 100% working --
for Garry's Mod Private messaging chat command /pm
/pm username message
-- message hides from everyone else in server except the
username.
serverside code -
function Drsgrgsgg(pl, text, teamonly)
if text:find( "/pm" ) then
for k,dhdddh in pairs(player.GetAll()) do
pl:SetNWInt("rsgggg", text)
local sgsg = pl:Name()
if string.match( string.Replace( text, "/pm", "" ), "[%a+]" , 1 ) == string.match( string.lower( dhdddh:Name() ), "[%a+]" , 1 )
or string.match( string.Replace( text, "/pm", "" ), "[%a+]" , 1 ) == string.match( dhdddh:Name() , "[%a+]" , 1 ) then
pl:SetNWInt("srhhr", pl:Name()) -- sender
util.AddNetworkString("dthrsrhrhd") -- gm_initialize
net.Start( "dthrsrhrhd", false )
net.WriteString( pl:GetNWInt("rsgggg") )
net.Send( dhdddh )
pl:SetNWInt("rsggsgrsggg", dhdddh:Name())
//print( "teset",dhdddh:Name() )
//print( "msg", pl:GetNWInt("rsgggg"))
end
end
end
end
hook.Add("PlayerSay", "dthdthsrgf", Drsgrgsgg)
// BELOW IS CLIENTSIDE CODE
local function Grhrdhrdhrdh(len, ply)
local ghrhh = net.ReadString() -- use the same number of bits that were written
//print( "Player ", " is " .. ghrhh .. " .")
chat.AddText( Color( 255, 255, 255 ), string.Replace( ghrhh, "/pm", "[PM Recieved]" ) )
end
net.Receive( "dthrsrhrhd", Grhrdhrdhrdh )