Net Library & util.AddNetworkString() throwing attempt to call field 'AddNetworkString' (a nil value)

Hi, I am trying to make script but when I start it it keep giving me this error :


[ERROR] addons/script_cm/lua/autorun/init.lua:61: attempt to call
field 'AddNetworkString' (a nil value)
  1. unknown - addons/script_cm/lua/autorun/init.lua:61

Heres the server side :



include("cl_init.lua")

util.AddNetworkString( "Wrong" )
net.Receive("Wrong", function(len, ply)
    ply:Kick( KICK_MESSAGE )
end)



and the client side :



hook.Add("InitPostEntity", "Check", function()
    local cc = system.GetCountry()

	if CW == true then

		if LIST == 1 then

			if ( not table.HasValue( ENGLISH_NAMES, cc ) ) then
				net.Start("Wrong")
        		net.SendToServer()

			else if LIST == 2 then

				if ( not table.HasValue( FRENCH_NAMES, cc ) ) then
					net.Start("Wrong")
        			net.SendToServer()

			else if LIST == 3 then
					
				if ( not table.HasValue( YOUR_NAMES, cc ) ) then
					net.Start("Wrong")
        			net.SendToServer()

				end
				end
			end
			end
			end
		end
	end
end)


Server and client sided Lua files have to go into autorun/realm/file.lua, autorun doesn’t work like the gamemode folder does. (Make sure your init.lua is in autorun/server/, and your cl_init in autorun/client/)

Okay thanks but for the include how do I include the cl_init.lua ?

[editline]29th July 2015[/editline]

maybe I don’t need to add it ?

You don’t need to include files that are in autorun. They are automatically ran (it’s in the name)

Thanks bro (virtual high five)

If it still doesn’t work after the user above said, add



if SERVER then


in the serverside file (at the top)

and



if CLIENT then


at the top of the clientside file

Okay guys thank you the facepunch community is so cool and active that’s not like the UE4 community