• net.Start is sending unpooled message?
    8 replies, posted
Hi, I am trying to make a hitmenu and i am having trouble with net.Start. So, In my script i have: if CLIENT then (under client this is what i have. I didnt put all code, Just whats important) [CODE]local textbox = vgui.Create("DTextEntry", frame) textbox:SetPos(15+label:GetWide(),40) textbox:SetSize(200,20) textbox:SetEnterAllowed(true) textbox.OnEnter = function() net.Start("cl_sendDonationKey") net.WriteString(textbox:GetValue()) net.SendToServer(); end[/CODE] Then i have: if SERVER then [CODE]util.AddNetworkString("cl_sendDonationKey") net.Receive("cl_sendDonationKey", function(len, ply) local key = net.ReadString() jaooeProcessKey(ply,key) end)[/CODE] For some reason its saying im sending an unpooled message. HELP ME!
Are you sure the script is being ran both server and clientside?
Yea, When i type my command, The menu and stuff pops up that i have as client. But the second i click enter with it sais unpooled message.
That doesn't mean it's running server side. Everything you just told me meant that the client side portion is working. Where did you place the script?
lua>autorun. It does if CLIENT first, Then it does IF SERVER after the if of the client
I hope you mean [code]if ( CLIENT ) then -- Client stuff else -- Server stuff end [/code]
Set the file up like this in a shared autorun folder (lua/autorun): [lua]if SERVER then AddCSLuaFile() print("Loading serverside content from: filename.lua") --Server shit elseif CLIENT then --Client shit end[/lua] With shared files it's generally best practice to run it in a Shared-Server-Client method, where you do shared functions first, then server functions, then finally client functions. Once the server is restarted, check the server console for the print. Or put a serverside concommand to ensure serverside code has loaded.
[code] util.AddNetworkString( "cl_sendDonationKey" )[/code] Put that serverside.
Okay. i got it working. I had 2 if SERVER's so i moved all my code to the first one. it works great. Thanks guys!
Sorry, you need to Log In to post a reply to this thread.