• How to make something pop up on spawn?
    9 replies, posted
This is in Choose\lua\autorun\lua\client\cl_choose.lua Isnt this supposed to work? [CODE]function OnPlayerSpawn( ply ) local window window = vgui.Create( "DFrame" ) window:SetTitle( "Choose A Faction!" ) window:SetSize( 300, 300 ) window:Center() window:SetVisible( true ) window:ShowCloseButton( true ) window:SetDraggable( true ) window:MakePopup() end DermaImageButton = vgui.Create( "DImageButton", window ) DermaImageButton:SetPos( 50, 52 ) DermaImageButton:SetSize( 200, 50 ) DermaImageButton:SetImage( "materials/us_icon.png" ) DermaImageButton:GetStretchToFit() DermaImageButton.DoClick = function() RunConsoleCommand ( "say", "/usrecruit" ) end DermaImageButton = vgui.Create( "DImageButton", window ) DermaImageButton:SetPos( 50, 113 ) DermaImageButton:SetSize( 200, 50 ) DermaImageButton:SetImage( "materials/ru_icon.png" ) DermaImageButton:GetStretchToFit() DermaImageButton.DoClick = function() RunConsoleCommand ( "say", "/rurecruit" ) end DermaImageButton = vgui.Create( "DImageButton", window ) DermaImageButton:SetPos( 50, 173 ) DermaImageButton:SetSize( 200, 50 ) DermaImageButton:SetImage( "materials/uk_icon.png" ) DermaImageButton:GetStretchToFit() DermaImageButton.DoClick = function() RunConsoleCommand ( "say", "/ukrecruit" ) end DermaImageButton = vgui.Create( "DImageButton", window ) DermaImageButton:SetPos( 50, 230 ) DermaImageButton:SetSize( 200, 50 ) DermaImageButton:SetImage( "materials/tali_icon.png" ) DermaImageButton:GetStretchToFit() DermaImageButton.DoClick = function() RunConsoleCommand ( "say", "/talirecruit" ) end end[/CODE]
[URL="http://wiki.garrysmod.com/page/GM/PlayerInitialSpawn"]PlayerInitialSpawn[/URL] [URL="http://wiki.garrysmod.com/page/Hook_Library_Usage"]Hook_Library_Usage[/URL]
[QUOTE=Keosan;51546238][URL="http://wiki.garrysmod.com/page/GM/PlayerInitialSpawn"]PlayerInitialSpawn[/URL] [URL="http://wiki.garrysmod.com/page/Hook_Library_Usage"]Hook_Library_Usage[/URL][/QUOTE] Ok so this is what I got Client Side (JobPicker\lua\autorun\client\cl_jobpicker.lua) [CODE]net.Receive( "OpenPicker", function() local window = vgui.Create( "DFrame" ) window:SetTitle( "Choose A Faction!" ) window:SetSize( 300, 300 ) window:Center() window:SetVisible( true ) window:ShowCloseButton( false ) window:SetDraggable( false ) window:MakePopup() DermaImageButton = vgui.Create( "DImageButton", window ) DermaImageButton:SetPos( 50, 52 ) DermaImageButton:SetSize( 200, 50 ) DermaImageButton:SetImage( "materials/us_icon.png" ) DermaImageButton:GetStretchToFit() DermaImageButton.DoClick = function() RunConsoleCommand ( "say", "/USRecruit" ) end DermaImageButton = vgui.Create( "DImageButton", window ) DermaImageButton:SetPos( 50, 113 ) DermaImageButton:SetSize( 200, 50 ) DermaImageButton:SetImage( "materials/ru_icon.png" ) DermaImageButton:GetStretchToFit() DermaImageButton.DoClick = function() RunConsoleCommand ( "say", "/rurecruit" ) end DermaImageButton = vgui.Create( "DImageButton", window ) DermaImageButton:SetPos( 50, 173 ) DermaImageButton:SetSize( 200, 50 ) DermaImageButton:SetImage( "materials/uk_icon.png" ) DermaImageButton:GetStretchToFit() DermaImageButton.DoClick = function() RunConsoleCommand ( "say", "/ukrecruit" ) end DermaImageButton = vgui.Create( "DImageButton", window ) DermaImageButton:SetPos( 50, 233 ) DermaImageButton:SetSize( 200, 50 ) DermaImageButton:SetImage( "materials/tali_icon.png" ) DermaImageButton:GetStretchToFit() DermaImageButton.DoClick = function() RunConsoleCommand ( "say", "/talibanrecruit" ) end end )[/CODE] Server Side (JobPicker\lua\autorun\server\sv_netmsg.lua) [CODE]util.AddNetworkString( "OpenPicker" ) net.Start( "OpenPicker" ) net.Send( ply )[/CODE] No errors just not poping up
Is ply actually a reference to a player in your net.Send?
[QUOTE=Leyserr;51546437]Is ply actually a reference to a player in your net.Send?[/QUOTE] Would ply already be referenced? Or do you have to do local ply = LocalPlayer ?
At the moment, I'm guessing your ply variable in nil. It's not representing a player, so you will have to assign it to a player. When do you want the menu to be opened? When a player enters a chat command?
[QUOTE=Snowa;51546561]Would ply already be referenced? Or do you have to do local ply = LocalPlayer ?[/QUOTE] no, you'll have to add a hook for when a player spawns
[QUOTE=Leyserr;51546683]At the moment, I'm guessing your ply variable in nil. It's not representing a player, so you will have to assign it to a player. When do you want the menu to be opened? When a player enters a chat command?[/QUOTE] I want it to open when the player joins the server, like the MOTD.
Example here: [url]https://github.com/SubjectAlpha/WorkshopDLPanel[/url]
[QUOTE=Subject_Alpha;51547733]Example here: [url]https://github.com/SubjectAlpha/WorkshopDLPanel[/url][/QUOTE] Thank you SO much this helped me so much!
Sorry, you need to Log In to post a reply to this thread.