ENT:Use

Hello,

How can i make it so when i use the ENT:Use in the init.lua it will open a menu that is on the cl_init.lua.

I would like to use networking :stuck_out_tongue:

The net library is one of a number of ways to send data between the client and server.

The major advantages of the net library is the large size limit compared to usermessage and console commands, 65533 bytes (64KiB with 3 bytes of unusable overhead) per message, and the ability to send data backwards - from the client to the server.

Read More:

Thats what i have been trying to use. Here is the code.

i have already got the util.AddNetworkString(“test_1”) at the top of the init.lua file.

init.lua

function ENT:Use(a, c)

net.Send("test_1") 

end

cl_init.lua

net.Receive(“test_1”, function()

local Frame = vgui.Create( "DFrame" )
Frame:SetPos( 5, 5 )
Frame:SetSize( 300, 150 )
Frame:SetTitle( "Name window" )
Frame:SetVisible( true )
Frame:SetDraggable( false )
Frame:ShowCloseButton( true )
Frame:MakePopup()

end)

You aren’t using the net functions correctly, lookup net.start

I changed it to net.Start yet nothing.

do



net.Start( 'test_1' ) -- Starts the net message u created
net.Send( player ) -- Sends to the player


Thank you.

[editline]19th December 2016[/editline]

Hasn’t worked my friend :stuck_out_tongue:

Net Library Usage

I know its already been suggested but go through this and play with the various examples, helped me when I had similar questions picking up usage of the net library.
You really shouldn’t struggle after reading through this.