• Open a derma a first spawn
    26 replies, posted
Client Side net.Recieve("somenetwork", function() local frame = vgui.Create("DFrame") frame:SetTitle ("") frame:SetSize(400, 800) frame:Center() frame:SetVisible(true) frame:MakePopup() frame:ShowCloseButton(true) end Server Side if (SERVER) then util.AddNetworkstring("somenetwork")    hook.Add("PlayerInitialSpawn", "OpenDerma", function(ply)    net.Start("somenetwork")    net.Send(ply)       end) I don't understand what is not working i followed the tutorial correctly GM/PlayerInitialSpawn
Why is SERVER in parenthesis?
No lua error the menu just doens't open
Edit: How about instead of dumb boxing you give some answers? Sick of all of you stuck up coders not lifting a finger to help but spamming the emotes and quick to be condescending.
Yes my console i clear
A few methods are discussed here though it looks like you may be missing an end and closing parenthesis. If you could provide a hastebin of your files that would probably be helpful. Here's the thread I found which seems to be exactly what you're doing: How can I make that a Derma Menu opens once the player spawn?
I looked it but the code that is given there if (SERVER) then util.AddNetworkstring("somenetwork") hook.Add("PlayerSpawn", "OpenDerma", function(ply) net.Start("somenetwork") net.Send(ply) end) endif (CLIENT) then net.Recieve("somenetwork", function()--Derma code hereend) end Where it go server side or client side
It doesn't matter if SERVER/CLIENT is in parentheses or not. That's completely preference. In Lua you are not required to surround expressions in if statements in parentheses, but you can choose to do it.
I think you are trying to open the menu too early when the player has not fully spawned in. Try to check if the player is valid and if not just make it loop until the player is valid.
InitPostEntity hook client-side I would say.
I dont think you know how this forum works...even the basic rules of this page list: If you get several "Dumb" ratings, dont cry about it. your an idiot, deal with it Right now they edit the rules pages..huh. But it was there anyway
You are the biggest neusance to new coders on this site. Why can't you just NOT be a dick? How hard is that? If you're going to be an asshole then just don't reply. People who ask dumb questions aren't going to go away any time soon. So as far as I can tell you come here to get off on this. Stop acting so pretentious because you were where the rest of us are at one point. I'm asking "dumb" questions to get informed answers. Stop being a twat.
you should really calm, down and act normal, as well not calling people dick, twat, and shitposting...many people tryd it. it ended up in a simple ban
Too many commas. Instructions unclear. So what I gather is that you intentionally go around pissing people off until they get banned
Not really sure how i am involved. You come here, ask super basic questions, cry if people give you basic answers or tell you to learn lua..and you insult
Hey y'all just stop replying to each other. Thread is neither of yours so stop shitting it up @niJ has the right idea. Unless there's actual data that the server needs to send to the client, that the client wouldn't have otherwise, opening a menu right after joining should just be left up to the client in an InitPostEntity hook. @Dolotboy in your most recent snippet I see "endif" which isn't proper, unless a space got omitted there somehow. Use "elseif" or "end if" if that's really how you want to structure it. Wouldn't make a difference here but in certain situations it would. That's the only issue I see with your code, other than that you just need to make sure the Lua file is being included at all serverside, and that it's being AddCSLuaFile'd and included clientside also.
Ok so what i did is create my file spawnmenu After spawnmenu/lua/autorun In my autorun i have 1 file and 1 folder The file is spawnmenu.lua in this file there is AddCSLuaFile( "cl_spawnmenu.lua" ) And in the folder client so spawnmenu/lua/autorun/client there is cl_spawnmenu.lua in this file there is if (SERVER) then util.AddNetworkstring("somenetwork")    hook.Add("PlayerSpawn", "OpenDerma", function(ply)    net.Start("somenetwork")    net.Send(ply)       end) endif (CLIENT) then    net.Recieve("somenetwork", function()local frame = vgui.Create("DFrame")   frame:SetSize(400, 800)   frame:SetTitle("")   frame:SetDraggable(true)   frame:MakePopup()   frame:SetVisible(true)   frame:ShowCloseButton(true)    end) end Is it ok like that because this doesn't work
Your AddCSLuaFile call should include the path to the file. Put the entire contents of the if (SERVER) block into spawnmenu.lua, and also move that file into spawnmenu/lua/autorun/server folder, and only leave the client portion in cl_spawnmenu.lua. So the two files look like this spawnmenu/lua/autorun/server/spawnmenu.lua AddCSLuaFile( "autorun/client/cl_spawnmenu.lua" ) util.AddNetworkstring("somenetwork") hook.Add("PlayerSpawn", "OpenDerma", function(ply) net.Start("somenetwork") net.Send(ply) end) spawnmenu/lua/autorun/client/cl_spawnmenu.lua net.Recieve("somenetwork", function() local frame = vgui.Create("DFrame") frame:SetSize(400, 800) frame:SetTitle("") frame:SetDraggable(true) frame:MakePopup() frame:SetVisible(true) frame:ShowCloseButton(true) end)
This doesn't work WTF when i spawn or respawn the menu doesn't open
Why are you still trying to net message it? Run GM/InitPostEntity Clientside and call it there...
As much as I agree, there may be a reason unknown to us that would require the finished product to be networked. Information that only the server knows at the time but that the menu would rely on, that sort of stuff. That's why I'm just rolling with the networked method in helping also. @Dolotboy the "spawnmenu" folder is in addons, right? It should be executing, and at the very least it should be spitting out a syntax error at startup into the server or client's console if there's something wrong with the script.
MEGA Can you look
That looks like it should be working.
util.AddNetworkstring("somenetwork") Capital error. It's util.AddNetworkString("somenetwork") + hook.Add("PlayerSpawn", "OpenDerma", function(ply) Name your hook something unique like hook.Add("PlayerSpawn", "AdviceAddon_OpenUI", function(ply) + net.Recieve Is spelt wrong.
Thx man seriously
btw for future reference, if you use vscode or sublime with a glua addon, they can automatically fill in method names and stuff so something like this doesn't happen again.
Sorry, you need to Log In to post a reply to this thread.