• Help with DComboBox (Again :sigh:)
    3 replies, posted
So I'm making a simple training system for roleplay servers that incorporate military ranks etc. The basic idea is whenever someone is about to start training the will use !train and select a users name. The user that is selected will have a box appear on their screen saying whether or not they would like to start the training or not -- i have not gotten to that bit yet -- I was just writing the basic derma frame and I realised I have no idea how to make a DComboBox and do something to the person selected inside it. here is my clientside function trainCommand( pl, text)             if string.sub( text, 1, 5 ) == "!train" then             pl:PrintMessage( 3, "It Worked!" )                 local frame = vgui.Create("DFrame")                 frame:SetSize(100, 100)                 frame:SetPos(100, 100)                 frame:SetVisible(true)                 frame:MakePopup()                 frame:SetDraggable(false)                 local comboBox = vgui.Create( "DComboBox", frame )                 comboBox:SetPos( 5, 30 )                 comboBox:SetSize( 100, 20 )                 comboBox:SetValue( "All Players" )                 comboBox.OnSelect = function( _, _, value )                     print( value.." was selected!" )                 end                 for k, v in pairs( player.GetAll() ) do                     comboBox:AddChoice( v:Name()) -- I know here that I can use comboBox:GetSelected() and also that AddChoice has a data field but I just have no idea how to incorporate it.                  end                 for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. pl:Nick() .. " has used !train to start training!" )         end     end end hook.Add( "PlayerSay", "Chat", trainCommand ) my question is how do I just send the players information to the server and run stuff on it from the server. I have not included that in my code. I know I'm asking for a lot but I'm really stuck lmao. thanks so much.
You'll want to learn the net library. Here are some useful links for you: Net Library Usage http://wiki.garrysmod.com/page/Category:net Essentially, you'll want the admin's client to send a message to the server, telling the server to send a message to the "trainee" player's client to open up your derma crap. Also, if you want to remove all default derma painting in your DFrames, run Frame:SetTitle("") and override its paint function.
Aaaah, thanks for the answer, but could you show me an example? It's one of those things where I see it once and I know how to do it, sorryyyyy <33
You obviously didn't bother reading one or either links I sent. http://wiki.garrysmod.com/page/Net_Library_Usage has examples for you at the bottom of the page.
Sorry, you need to Log In to post a reply to this thread.