Message is pooled but if i put some code it won't be pooled for some reason

So I’m new to this networking thing, (glua in general lol) and i’ve done a system in which when you press shift you run faster. The thing is that it works perfectly, but I want to add that when you get to a speed the player is kind of ragdolled during a period of time (like he slipped and fell into the floor). It works completely well without the added code (which is the speed3 thing) but when i add it it gives me this error, even though all strings have been added (line 69 btw is the ‘net.Start(“wannaragdolls1”)’ thing)



[ERROR] lua/autorun/client/semi_perfect_scrip.lua:69: Calling net.Start with unpooled message name! [http://goo.gl/qcx0y]
  1. Start - [C]:-1
   2. fn - lua/autorun/client/semi_perfect_scrip.lua:69
    3. unknown - addons/ulib_557962238/lua/ulib/shared/hook.lua:109


This is at serverside:



speedAt1 = 300 //speed at level 1
speedAt2 = 400 //speed at level 2
speedAt3 = 500 //speed at level 3
speedAt4 = 600 //speed at level 4
speedAt5 = 650 //speed at level 5

util.AddNetworkString( "speed1" )
util.AddNetworkString( "speed2" )
util.AddNetworkString( "speed3" )
util.AddNetworkString( "speed4" )
util.AddNetworkString( "speed5" )

net.Receive("speed1", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt1, speedAt1)
	end
	)

net.Receive("speed2", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt2, speedAt2)
	end
	)

net.Receive("speed3", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt3, speedAt3)
  if ply:GetVelocity():Length() > 0 then
   elseif ply:IsOnGround() == false then
       elseif math.random(0,100) < 3 then
        print("i work")
      	end
      end
  end
	end)

net.Receive("speed4", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt4, speedAt4)
	end
	)

net.Receive("speed5", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt5, speedAt5)
	end
	)


Client code (not all the code but the part that contains the net start)



hook.Add("Think","ragdollTrigger", function(ply, mv)  
if speed == 3 then
   net.Start("speed3")
   net.SendToServer()
end


You need to use util.AddNetworkString for ALL net messages.

What do you mean by that? I added all the util.strings thing

util.AddNetworkString( “speed1” )
util.AddNetworkString( “speed2” )
util.AddNetworkString( “speed3” )
util.AddNetworkString( “speed4” )
util.AddNetworkString( “speed5” )

In fact it works without the code:

if ply:GetVelocity():Length() > 0 then
elseif ply:IsOnGround() == false then
elseif math.random(0,100) < 3 then
print(“i work”)
end
end
end

Thats what i dont understand, if you could give me an example id be very grateful

You never added “wannaragdolls1”.

Sorry, when i copied the code i copied the wrong part, the thing is there is something like a

if speed == 3 then
net.start(“speed3”)
net.sendToServer()
end

The problem here is that the code of speed3 ( in the server ) for some reason breaks the whole code and wont work, but without it it works (i checked it)

You need to wait a few frames before sending the net message after you pool a network string.

It works completely fine without the code (connects and does stuff)

if ply:GetVelocity():Length() > 0 then
elseif ply:IsOnGround() == false then
elseif math.random(0,100) < 3 then
print(“i work”)
end
end
end

So it cant be that, i think that it is a problem in the code and not in the networking
I cant find it though :frowning:

Also I just want to point out that your code is highly vulnerable because you are allowing the player to say what speed they should be, instead of letting the server determine it. You don’t need net messages at all for what you are trying to do.

I ended up solving it, it was just that the code was wrong (for some reason if any of net.receive is wrong , it will mess up everything) and i’ll also modify it so the server determines the speed (and not the player) thanks! (im new at this so ye)



speedAt1 = 300 //speed at level 1
speedAt2 = 400 //speed at level 2
speedAt3 = 500 //speed at level 3
speedAt4 = 600 //speed at level 4
speedAt5 = 650 //speed at level 5

util.AddNetworkString( "speed1" )
util.AddNetworkString( "speed2" )
util.AddNetworkString( "speed3" )
util.AddNetworkString( "speed4" )
util.AddNetworkString( "speed5" )

net.Receive("speed1", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt1, speedAt1)
	end
	)

net.Receive("speed2", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt2, speedAt2)
	end
	)

net.Receive("speed3", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt3, speedAt3)
  if ply:GetVelocity():Length() > 0 then
  if ply:IsOnGround() == false then
  if math.random(0,100) > 50 then
  	print("i work")
  end
  end
  end
  end)

net.Receive("speed4", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt4, speedAt4)
	end
	)

net.Receive("speed5", function(len, ply)
GAMEMODE:SetPlayerSpeed( ply, speedAt5, speedAt5)
	end
	)