Derma text entry help

So what I’m trying to do is send the text from my derma text entry to all admins online.
Where the derma part is client sided, and where to specify to add the dermatext to a admins chat box is server side related.

From my last thread I made I learned about the net library(start, receive, send, etc) but that was for server to client, but in this case its client to server.
and I’m a bit lost on how to proceed with this, for net.send is a server sided command.

So I’m not really sure how to approach this, so if someone could give me a explanation on where to approach this from that would be great. Thanks!

net.SendToServer(). Use damn wiki.

The net library actually does work from client to server.

Although creating a console command on the server, and then running that console command from the client will work as well.


Either way you do it, make sure you do security checks serverside so players don’t spam or send messages to the admins when they shouldn’t be allowed.

[editline]1st June 2013[/editline]

Not everyone pro like you. (;

I was using the wiki, I guess I just missed it.

Alright this clears some things up, thanks, I’m sure I can get it working now.

oh, and about the spamming admins thing, the derma text entry is only accessible after death, it’s part of my “death menu”.I’m sure I can make it force close the entry box after entered has been pushed, or disable it if i remember right.

Hmm, how could I make it so the server side knows the dtextentry entered from the player?

    local DermaText = vgui.Create( "DTextEntry", DermaPanel2 )
    DermaText:SetPos( 20,(70/2) )
    DermaText:SetTall( 20 )
    DermaText:SetWide( 450 )
    DermaText:SetEnterAllowed( true )
    DermaText.OnEnter = function(ply)
        LocalPlayer():ChatPrint("Message Sent!")
        print("client") -- just testing
function notifyadmin(len, ply)
    if ply:IsAdmin() then
        ply:ChatPrint(DermaText:GetValue()) --Doesn't work since it's on the server side oppose to the  client side.
        ply:ChatPrint("server1") -- just testing
        ply:ChatPrint("server2") -- just testing
net.Receive("notifyadmins", notifyadmin)


Okay, I understand now!
I added this, for those interested.

local dstring = DermaText:GetValue()
ply:ChatPrint("this should show the dtext entry:" .. net.ReadString() .. "!")

Now all I need to do is figure out how to correctly send the message to all admins online, not just if the player is an admin. I’ll mark as solved if I find out myself.

sry for bumping an old thread, but can someone post the entire code.