Hey everyone.
I am trying to do the following:
Concommand > Net Message to the client > Some derma stuff (button) > Net message back to the server > ERROR!
This is the error:
[ERROR] gamemodes/fearthemossman/gamemode/cl_init.lua:36: Calling net.Start with unpooled message name [[url]http://goo.gl/qcx0y][/url]
1. Start - [C]:-1
2. DoClick - gamemodes/fearthemossman/gamemode/cl_init.lua:36
3. unknown - lua/vgui/dlabel.lua:206
This is the SERVER code:
[LUA]
include( 'shared.lua' )
util.AddNetworkString("joinServer")
util.AddNetworkString("initializeJoin")
function playerEmptyChecker( ply )
local counter = 0
for k,pl in pairs(player.GetAll()) do
counter = counter + 1
end
if counter == 1 then
ply:SetTeam(2)
ply:PrintMessage("Welcome to the server "..ply:Nick().."! You are the first player on, so you have become the mossman. Wait for victims to join...")
elseif counter == 2 then
ply:SetTeam(1)
ply:PrintMessage("Welcome to the server "..ply:Nick().."! You are the second player on, so you have become a runner. Run from the mossman!")
elseif counter > 2 then
ply:SetTeam(0)
ply:PrintMessage("Welcome to the server "..ply:Nick().."! Please have patience while the round is being played.")
end
end
net.Receive("initializeJoin", playerEmptyChecker)
function playerJoinServer( ply )
net.Start("joinServer")
net.Send( ply )
end
hook.Add("PlayerInitialSpawn", "playerJoinServer", playerJoinServer)
[/LUA]
This is the CLIENT code:
[LUA]
include( 'shared.lua' )
local lply = LocalPlayer()
function hideDefaultHUD( name )
for k,elem in pairs({"CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo"}) do
if name == elem then
return false
end
end
end
hook.Add("HUDShouldDraw", "hideDefaultHUD", hideDefaultHUD)
function playerJoinVGUI( ply )
local frame = vgui.Create( "DFrame" )
frame:SetSize( 300,250 )
frame:SetTitle( "Welcome to the server..." )
frame:SetVisible( true )
frame:SetDraggable( true )
frame:ShowCloseButton( true )
frame:MakePopup()
frame:Center()
local b1 = vgui.Create( "DButton" )
b1:SetParent( frame )
b1:SetText( "Join Game" )
b1:SetPos( 25, 50 )
b1:SetSize( 150, 50 )
b1.DoClick = function ()
net.Start("initializeJoin")
net.SendToServer()
end
end
net.Receive("joinServer", playerJoinVGUI)
[/LUA]
I am trying to send the "initializeJoin" message from the client, to the "playerEmptyChecker" function.
But I get the error.
Any help is appriciated :D
- Fillipuster
[url]http://goo.gl/qcx0y[/url]
[editline]3rd August 2014[/editline]
It tells you exactly what is wrong.
@Robotboy655
I already pooled the network string:[URL="http://puu.sh/aDkwb/e0de2a5451.png"]http://puu.sh/aDkwb/e0de2a5451.png[/URL]
The network strings must be added in a SERVER file regardless of where they are from and to. If it says it is unpooled, it is because there is either a typo, or the util.AddNetworkString wasn't called for that exact message server-side.
[QUOTE=Acecool;45583155]The network strings must be added in a SERVER file regardless of where they are from and to. If it says it is unpooled, it is because there is either a typo, or the util.AddNetworkString wasn't called for that exact message server-side.[/QUOTE]
But it does work with joinServer, since that's the only way he can test if the other one works?
Very strange.... If joinServer is working, then the other one should work too unless there is an invisible character screwing something up ( I've had odd things happen in C++ where I'd copy/paste the name of a function and it would error, upon re-writing the word it worked and switching between the two made NO difference )... It could be a stupid bug, or something else.
Feel free to add me on Steam, I'll help you work through it.
Are you writing your own game-mode OP? Take a look at this for HUD creation ( 15 seconds down to 0.08 seconds over 100 million iterations using the HUDShouldDraw direct-access VS table.HasValue ): [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/proper_hud_creation.lua.html[/url]
If you are writing your own GM take a look at what I'm working on. Basically a base-gamemode with helper-functions and things to make everything move quicker. An autoloader which checks filenames, folders etc to determine the realm of the file.
If you want something to make development easier use this: [url]https://bitbucket.org/Acecool/acecooldev_base/src/[/url]
rename the folder, the txt file, and the name at the top of the txt file in quotes. Then, drag and drop files.
You can create the folder structure by typing install in console; or download and extract this in the gm folder: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_redistributable/acecooldev_base_folder_struct.rar[/url]
Folder structure: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_redistributable/acecooldev_base/documentation/folder_structure_and_how_to_use_it.txt[/url]
File loading options: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_redistributable/acecooldev_base/documentation/file_recursive_inclusions.txt[/url]
Basically, client/ server/ and shared/ folders update the realm state in the recursive loading function meaning when one of those folders is opened, they will load in the relevant realm unless the filename contains information telling it to load into a different realm or not at all ( x_*.lua, _x_*.lua and _x.lua )..
maps/ folders load maps/<map_name>/* on OnReloaded and InitPostEntity so that if you spawn entities, it won't change the EntIndex value of map entities so that a hash-map can be used to remove existing entities with this: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/entities/entity_getid_mapping_system.lua.html[/url]
This is my game-mode and how files are loaded: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_file_structure/files_order.txt[/url]
Take note as to what was said above and look at files changing the realm they're loaded in on the fly in a shared/ folder.
[code][32] = [SHARED] :: gamemode/shared/classes/elevator/_sh_elevator.lua
[33] = [CLIENT] :: gamemode/shared/classes/elevator/cl_elevator.lua
[34] = [SERVER] :: gamemode/shared/classes/elevator/sv_elevator.lua
[35] = [SHARED] :: gamemode/shared/classes/jobs/_class_jobs.lua
[36] = [SERVER] :: gamemode/shared/classes/jobs/_sv_class_jobs.lua
[37] = [SHARED] :: gamemode/shared/classes/networking/_sh_networking.lua
[38] = [CLIENT] :: gamemode/shared/classes/networking/cl_networking.lua
[39] = [SERVER] :: gamemode/shared/classes/networking/sv_networking.lua
[40] = [SHARED] :: gamemode/shared/classes/npc/_sh_npc.lua
[41] = [CLIENT] :: gamemode/shared/classes/npc/cl_npc.lua
[42] = [SERVER] :: gamemode/shared/classes/npc/sv_npc.lua
[43] = [SHARED] :: gamemode/shared/classes/class_bullets.lua
[44] = [SHARED] :: gamemode/shared/classes/class_card.lua
[45] = [SHARED] :: gamemode/shared/classes/class_cards.lua[/code]
It just makes it easier to group like files together and load it into a specific realm.
Unlimited folder nesting is supported.. It is as easy and dragging and dropping files into folders.
Also, you can disable auto-refresh with the autoloader; just type loadgm to refresh the game-mode. If you add a new file, type loadgm and save the new file once to have it detected ( with autorefresh on ). It works in Linux too, without autorefresh! I'll be adding a lot of things to the bitbucket such as helper-functions, wrappers, metatable objects / "classes", etc... Basically, it makes it easy to make a new game-mode by providing a lot of the building blocks, or with the simple system ( just using the auto-loader ) to make file-loading easy without having to mess with AddCSLuaFile or include functions.
You literally just went on an entire tangent over a simple question about why it might not be loading his net messages, and half of the tangent doesn't even make sense. Please learn the matter of what you're talking about before confusing someone else. Hell, he didn't even ask "Help me with making a gamemode!" he just asked about network.
Regardless OP, first try using a different network name. If that fails, try another file. Sometimes it may be something silly or stupid that just needs a small change.
function playerEmptyChecker( ply )
should be
function playerEmptyChecker(length, ply)
by the way.
[QUOTE=Chessnut;45586827]function playerEmptyChecker( ply )
should be
function playerEmptyChecker(length, ply)
by the way.[/QUOTE]
I will add that and see if it works. Thanks :D
[QUOTE=Nookyava;45586550]You literally just went on an entire tangent over a simple question about why it might not be loading his net messages, and half of the tangent doesn't even make sense. Please learn the matter of what you're talking about before confusing someone else. Hell, he didn't even ask "Help me with making a gamemode!" he just asked about network.
Regardless OP, first try using a different network name. If that fails, try another file. Sometimes it may be something silly or stupid that just needs a small change.[/QUOTE]
I will try that. I though about doing it, but that was late yesterday... too tired... xD
- Thanks.
[editline]4th August 2014[/editline]
Okay, I am trying to test this in-game. Is there anything I can type in the console to mimic a player (me) joining (PlayerInitialSpawn) ?
Sorry, you need to Log In to post a reply to this thread.