0

I have 2 scripts: 1)init.lua - server script that handles net requests. 2) change_team.lua - client script that handles vgui buttons and sends net requests. Problem: When pressing the DButton2 button in an attempt to send a net request, an error occurs:

[ERROR] gamemodes/redwarbonds/gamemode/change_team.lua:36: Calling net.Start with unpooled message name! (Did you forget to call util.AddNetworkString serverside?) 1.Start - [C]:-1 2. DoClick - gamemodes/redwarbonds/gamemode/change_team.lua:36 3. unknown - lua/vgui/dlabel.lua:237 (x2)

The code of these 2 scripts: 1)init.lua:

AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
--AddCSLuaFile( "menu.lua" )
--AddCSLuaFile( "cursor.lua" )
AddCSLuaFile( "change_team.lua" )
AddCSLuaFile( "sv_net.lua" )

until.AddNetworkString("SendAge")

net.Receive("SendAge", function()
local ply = net.ReadEntity()
print(ply)
end)

2)change_team.lua:

local DFrame1 = vgui.Create("DFrame") 
DFrame1:SetSize(2560, 1400) 
DFrame1:SetTitle("Derma Frame") 
DFrame1:MakePopup() 
DFrame1:ShowCloseButton( false )
DFrame1:SetDraggable( false )
DFrame1:SetTitle( "" )


DFrame1.Paint = function(self, w, h)
draw.RoundedBox(4, 600, 355, 740, 780, Color(255, 0, 0, 0))
end

--------------------------------------------------------
local DButton1 = vgui.Create( "DButton", DFrame1 ) 
DButton1:SetText( "Blue" )                  
DButton1:SetPos( ScrW()-760, 695 )                  
DButton1:SetSize( 220, 220 )                    
DButton1.DoClick = function()               
    print("Button Run1")    
end

DButton1.DoRightClick = function()
    print("Button Run1")    
end
-------------------- --- -- - - -
local DButton2 = vgui.Create( "DButton", DFrame1 ) 
DButton2:SetText( "Red" )                   
DButton2:SetPos( 820, 675 )                 
DButton2:SetSize( 220, 220 )                    
DButton2.DoClick = function()       
         net.Start("SendAge")
        local nushniy= LocalPlayer()
         net.WriteEntity(nushniy)
         net.SendToServer()
end

DButton2.DoRightClick = function()
    print("Button Run2")
end

I did exactly as it was written in the tutorials. Also I found out that the error is:

Calling net.Start with unpooled message name! 

Occurs if you do not write before the server net processing code:

util.AddNetworkString 

But as you can see in my server code have this! The only thing that might be causing the problem is the vgui button click function, but I don't know why? Net requests can work together with vgui? Please help me!

Fix Egg
  • 1
  • 1

0 Answers0